


import string



def     __lowerCAmelCase						(							snake_case	:    str )       ->							None:
   for key in range(len(string.ascii_uppercase ) ):
      __lowerCamelCase:				Dict     =	""""""
      for symbol in message:
         if symbol in string.ascii_uppercase:
            __lowerCamelCase:				Optional[Any]     =	string.ascii_uppercase.find(snake_case )
            __lowerCamelCase:				str     =	num - key
            if num < 0:
               __lowerCamelCase:				Optional[int]     =	num + len(string.ascii_uppercase )
            __lowerCamelCase:				int     =	translated + string.ascii_uppercase[num]
         else:
            __lowerCamelCase:				Union[str, Any]     =	translated + symbol
      print(f'Decryption using Key #{key}: {translated}' )



def     __lowerCAmelCase						(							)       ->							None:
   __lowerCamelCase:				Tuple     =	input("""Encrypted message: """ )
   __lowerCamelCase:				str     =	message.upper()
   decrypt(snake_case )


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   main()






_A		:				Tuple									=       '''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''



def     __lowerCAmelCase						(							)       ->							None:
   __lowerCamelCase:				Optional[int]     =	input("""Enter message: """ )
   __lowerCamelCase:				Dict     =	input("""Enter key [alphanumeric]: """ )
   __lowerCamelCase:				List[Any]     =	input("""Encrypt/Decrypt [e/d]: """ )

   if mode.lower().startswith("""e""" ):
      __lowerCamelCase:				Optional[int]     =	"""encrypt"""
      __lowerCamelCase:				Optional[int]     =	encrypt_message(snake_case						,      snake_case )
   elif mode.lower().startswith("""d""" ):
      __lowerCamelCase:				Union[str, Any]     =	"""decrypt"""
      __lowerCamelCase:				Optional[Any]     =	decrypt_message(snake_case						,      snake_case )

   print(f'\n{mode.title()}ed message:' )
   print(snake_case )



def     __lowerCAmelCase						(							snake_case	:    str						,      snake_case	:    str )       ->							str:
   return translate_message(snake_case						,      snake_case						,      """encrypt""" )



def     __lowerCAmelCase						(							snake_case	:    str						,      snake_case	:    str )       ->							str:
   return translate_message(snake_case						,      snake_case						,      """decrypt""" )



def     __lowerCAmelCase						(							snake_case	:    str						,      snake_case	:    str						,      snake_case	:    str )       ->							str:
   __lowerCamelCase:				Any     =	[]
   __lowerCamelCase:				Optional[int]     =	0
   __lowerCamelCase:				Any     =	key.upper()

   for symbol in message:
      __lowerCamelCase:				int     =	LETTERS.find(symbol.upper() )
      if num != -1:
         if mode == "encrypt":
            num += LETTERS.find(key[key_index] )
         elif mode == "decrypt":
            num -= LETTERS.find(key[key_index] )

         num %= len(snake_case )

         if symbol.isupper():
            translated.append(LETTERS[num] )
         elif symbol.islower():
            translated.append(LETTERS[num].lower() )

         key_index += 1
         if key_index == len(snake_case ):
            __lowerCamelCase:				Union[str, Any]     =	0
      else:
         translated.append(snake_case )
   return "".join(snake_case )


if __name__ == "__main__":
   main()


