"""simple docstring"""







from __future__ import annotations

from string import ascii_letters


def 					a__ (						UpperCAmelCase__    :     str						,     UpperCAmelCase__    :     int						,     UpperCAmelCase__    :     str | None = None     )->		str:
						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     )->		str:
						key *= -1

						return encrypt(UpperCAmelCase__						,     UpperCAmelCase__						,     UpperCAmelCase__     )


def 					a__ (						UpperCAmelCase__    :     str						,     UpperCAmelCase__    :     str | None = None     )->		dict[int, str]:
						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 collections import namedtuple

UpperCamelCase_    :    Any											=						namedtuple("""from_to""", """from_ to""")

UpperCamelCase_    :    Union[str, Any]											=						{
    """millimeter""": """mm""",
    """centimeter""": """cm""",
    """meter""": """m""",
    """kilometer""": """km""",
    """inch""": """in""",
    """inche""": """in""",  # Trailing 's' has been stripped off
    """feet""": """ft""",
    """foot""": """ft""",
    """yard""": """yd""",
    """mile""": """mi""",
}

UpperCamelCase_    :    str											=						{
    """mm""": from_to(0.001, 1000),
    """cm""": from_to(0.01, 100),
    """m""": from_to(1, 1),
    """km""": from_to(1000, 0.001),
    """in""": from_to(0.0254, 39.3701),
    """ft""": from_to(0.3048, 3.2_8084),
    """yd""": from_to(0.9144, 1.0_9361),
    """mi""": from_to(1609.34, 0.0_0062_1371),
}


def 					a__ (						UpperCAmelCase__    :     float						,     UpperCAmelCase__    :     str						,     UpperCAmelCase__    :     str     )->		float:
						UpperCAmelCase__   		=						from_type.lower().rstrip("""s"""     )
						UpperCAmelCase__   		=						TYPE_CONVERSION.get(UpperCAmelCase__						,     UpperCAmelCase__     )
						UpperCAmelCase__   		=						to_type.lower().rstrip("""s"""     )
						UpperCAmelCase__   		=						TYPE_CONVERSION.get(UpperCAmelCase__						,     UpperCAmelCase__     )
						if new_from not in METRIC_CONVERSION:
												UpperCAmelCase__   		=						(
												    f'Invalid \'from_type\' value: {from_type!r}.\n'
												    f'Conversion abbreviations are: {", ".join(UpperCAmelCase__     )}'
												)
												raise ValueError(UpperCAmelCase__     )
						if new_to not in METRIC_CONVERSION:
												UpperCAmelCase__   		=						(
												    f'Invalid \'to_type\' value: {to_type!r}.\n'
												    f'Conversion abbreviations are: {", ".join(UpperCAmelCase__     )}'
												)
												raise ValueError(UpperCAmelCase__     )
						return value * METRIC_CONVERSION[new_from].from_ * METRIC_CONVERSION[new_to].to


if __name__ == "__main__":
						import doctest

						doctest.testmod()

