


def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : str    ):
     __UpperCamelCase   							=''
     for ch in key:
          if ch == " " or ch not in key_no_dups and ch.isalpha():
               key_no_dups += ch
     return key_no_dups

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : str    ):
     __UpperCamelCase   							=[chr(i + 65    ) for i in range(26    )]
     # Remove duplicate characters from key
     __UpperCamelCase   							=remove_duplicates(key.upper()    )
     __UpperCamelCase   							=len(SCREAMING_SNAKE_CASE__    )
     # First fill cipher with key characters
     __UpperCamelCase   							={alphabet[i]: char for i, char in enumerate(SCREAMING_SNAKE_CASE__    )}
     # Then map remaining characters in alphabet to
     # the alphabet from the beginning
     for i in range(len(SCREAMING_SNAKE_CASE__    )      ,					26    ):
          __UpperCamelCase   							=alphabet[i - offset]
          # Ensure we are not mapping letters to letters previously mapped
          while char in key:
               offset -= 1
               __UpperCamelCase   							=alphabet[i - offset]
          __UpperCamelCase   							=char
     return cipher_alphabet

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : str      ,					SCREAMING_SNAKE_CASE__      : dict[str, str]    ):
     return "".join(cipher_map.get(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    ) for ch in message.upper()    )

def 						_UpperCAmelCase    (      SCREAMING_SNAKE_CASE__      : str      ,					SCREAMING_SNAKE_CASE__      : dict[str, str]    ):
     __UpperCamelCase   							={v: k for k, v in cipher_map.items()}
     return "".join(rev_cipher_map.get(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    ) for ch in message.upper()    )

def 						_UpperCAmelCase    (      ):
     __UpperCamelCase   							=input('Enter message to encode or decode: '    ).strip()
     __UpperCamelCase   							=input('Enter keyword: '    ).strip()
     __UpperCamelCase   							=input('Encipher or decipher? E/D:'    ).strip()[0].lower()
     try:
          __UpperCamelCase   							={'e': encipher, 'd': decipher}[option]
     except KeyError:
          raise KeyError('invalid input option'    )
     __UpperCamelCase   							=create_cipher_map(SCREAMING_SNAKE_CASE__    )
     print(func(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__    )    )


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   main()









from ..utils import DummyObject, requires_backends






class    UpperCAmelCase__	( metaclass=A_		):



    """simple docstring"""






    UpperCAmelCase__						:		Any              =  ["speech"]






    def __init__(      self ,       *A_ ,       **A_   )  ->	Any:
         requires_backends(self ,       ['speech']   )






class    UpperCAmelCase__	( metaclass=A_		):



    """simple docstring"""






    UpperCAmelCase__						:		Union[str, Any]              =  ["speech"]






    def __init__(      self ,       *A_ ,       **A_   )  ->	Union[str, Any]:
         requires_backends(self ,       ['speech']   )





