






from typing import Literal

_a       =    '''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''


def __A       ( __lowerCAmelCase					,						__lowerCAmelCase					,						__lowerCAmelCase      )->    str:





						"""simple docstring"""



						_UpperCAmelCase							   =     LETTERS if mode == 'decrypt' else key
						_UpperCAmelCase							   =     key if mode == 'decrypt' else LETTERS
						_UpperCAmelCase							   =     ''
						# loop through each symbol in the message
						for symbol in message:
												if symbol.upper() in chars_a:
																		# encrypt/decrypt the symbol
																		_UpperCAmelCase							   =     chars_a.find(symbol.upper()      )
																		if symbol.isupper():
																								translated += chars_b[sym_index].upper()
																		else:
																								translated += chars_b[sym_index].lower()
												else:
																		# symbol is not in LETTERS, just add it
																		translated += symbol
						return translated


def __A       ( __lowerCAmelCase					,						__lowerCAmelCase      )->    str:





						"""simple docstring"""



						return translate_message(__lowerCAmelCase					,						__lowerCAmelCase					,						'encrypt'      )


def __A       ( __lowerCAmelCase					,						__lowerCAmelCase      )->    str:





						"""simple docstring"""



						return translate_message(__lowerCAmelCase					,						__lowerCAmelCase					,						'decrypt'      )


def __A       ( )->    None:





						"""simple docstring"""



						_UpperCAmelCase							   =     'Hello World'
						_UpperCAmelCase							   =     'QWERTYUIOPASDFGHJKLZXCVBNM'
						_UpperCAmelCase							   =     'decrypt'  # set to 'encrypt' or 'decrypt'

						if mode == "encrypt":
												_UpperCAmelCase							   =     encrypt_message(__lowerCAmelCase					,						__lowerCAmelCase      )
						elif mode == "decrypt":
												_UpperCAmelCase							   =     decrypt_message(__lowerCAmelCase					,						__lowerCAmelCase      )
						print(F"""Using the key {key}, the {mode}ed message is: {translated}"""      )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		main()








from __future__ import annotations

import re


def __A       ( __lowerCAmelCase      )->    list[str]:





						"""simple docstring"""



						def alphanum_key(__lowerCAmelCase      ):
												return [int(__lowerCAmelCase      ) if s.isdigit() else s.lower() for s in re.split('([0-9]+)'					,						__lowerCAmelCase      )]

						return sorted(__lowerCAmelCase					,						key=__lowerCAmelCase      )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
