"""simple docstring"""







from __future__ import annotations

from string import ascii_letters


def 					a__ (						UpperCAmelCase__    :     str						,     UpperCAmelCase__    :     int						,     UpperCAmelCase__    :     str | None = None     ):
						UpperCAmelCase__   		=						alphabet or ascii_letters

						# The final result string
						UpperCAmelCase__   		=						""""""

						for character in input_string:
												if character not in alpha:
																		# Append without encryption if character is not in the alphabet
																		result += character
												else:
																		# Get the index of the new key and make sure it isn't too large
																		UpperCAmelCase__   		=						(alpha.index(UpperCAmelCase__     ) + key) % len(UpperCAmelCase__     )

																		# Append the encoded character to the alphabet
																		result += alpha[new_key]

						return result


def 					a__ (						UpperCAmelCase__    :     str						,     UpperCAmelCase__    :     int						,     UpperCAmelCase__    :     str | None = None     ):
						key *= -1

						return encrypt(UpperCAmelCase__						,     UpperCAmelCase__						,     UpperCAmelCase__     )


def 					a__ (						UpperCAmelCase__    :     str						,     UpperCAmelCase__    :     str | None = None     ):
						UpperCAmelCase__   		=						alphabet or ascii_letters

						# To store data on all the combinations
						UpperCAmelCase__   		=						{}

						# Cycle through each combination
						for key in range(1						,     len(UpperCAmelCase__     ) + 1     ):
												# Decrypt the message and store the result in the data
												UpperCAmelCase__   		=						decrypt(UpperCAmelCase__						,     UpperCAmelCase__						,     UpperCAmelCase__     )

						return brute_force_data


if __name__ == "__main__":
						while True:
												print(F"""\n{"-" * 10}\n Menu\n{"-" * 10}""")
												print(*["""1.Encrypt""", """2.Decrypt""", """3.BruteForce""", """4.Quit"""], sep="""\n""")

												# get user input
												UpperCamelCase_    :    Any											=						input("""\nWhat would you like to do?: """).strip() or """4"""

												# run functions based on what the user chose
												if choice not in ("1", "2", "3", "4"):
																		print("""Invalid choice, please enter a valid choice""")
												elif choice == "1":
																		UpperCamelCase_    :    List[Any]											=						input("""Please enter the string to be encrypted: """)
																		UpperCamelCase_    :    str											=						int(input("""Please enter off-set: """).strip())

																		print(encrypt(input_string, key))
												elif choice == "2":
																		UpperCamelCase_    :    str											=						input("""Please enter the string to be decrypted: """)
																		UpperCamelCase_    :    str											=						int(input("""Please enter off-set: """).strip())

																		print(decrypt(input_string, key))
												elif choice == "3":
																		UpperCamelCase_    :    Any											=						input("""Please enter the string to be decrypted: """)
																		UpperCamelCase_    :    Optional[Any]											=						brute_force(input_string)

																		for key, value in brute_force_data.items():
																								print(F"""Key: {key} | Message: {value}""")

												elif choice == "4":
																		print("""Goodbye.""")
																		break


"""simple docstring"""







from __future__ import annotations

from collections import Counter


def 					a__ (						UpperCAmelCase__    :     int     )->		list[int]:
						UpperCAmelCase__   		=						[True] * n
						UpperCAmelCase__   		=						False
						UpperCAmelCase__   		=						False
						UpperCAmelCase__   		=						True

						for i in range(3						,     int(n**0.5 + 1     )						,     2     ):
												UpperCAmelCase__   		=						i * 2
												while index < n:
																		UpperCAmelCase__   		=						False
																		UpperCAmelCase__   		=						index + i

						UpperCAmelCase__   		=						[2]

						for i in range(3						,     UpperCAmelCase__						,     2     ):
												if is_prime[i]:
																		primes.append(UpperCAmelCase__     )

						return primes


def 					a__ (						UpperCAmelCase__    :     int     )->		list[list[int]]:
						UpperCAmelCase__   		=						str(UpperCAmelCase__     )
						UpperCAmelCase__   		=						[]
						UpperCAmelCase__   		=						["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

						for duplicate in Counter(UpperCAmelCase__     ) - Counter(set(UpperCAmelCase__     )     ):
												UpperCAmelCase__   		=						[int(number_str.replace(UpperCAmelCase__						,     UpperCAmelCase__     )     ) for digit in digits]
												replacements.append(UpperCAmelCase__     )

						return replacements


def 					a__ (						UpperCAmelCase__    :     int = 8     )->		int:
						UpperCAmelCase__   		=						set()

						# Filter primes with less than 3 replaceable digits
						UpperCAmelCase__   		=						{
						    x for x in set(prime_sieve(1_0_0_0_0_0_0     )     ) if len(str(UpperCAmelCase__     )     ) - len(set(str(UpperCAmelCase__     )     )     ) >= 3
						}

						for prime in primes:
												if prime in numbers_checked:
																		continue

												UpperCAmelCase__   		=						digit_replacements(UpperCAmelCase__     )

												for family in replacements:
																		numbers_checked.update(UpperCAmelCase__     )
																		UpperCAmelCase__   		=						primes.intersection(UpperCAmelCase__     )

																		if len(UpperCAmelCase__     ) != family_length:
																								continue

																		return min(UpperCAmelCase__     )

						return -1


if __name__ == "__main__":
						print(solution())

