




"""simple docstring"""


def 	lowercase_				(			__UpperCAmelCase				)						->    str:
      lowerCAmelCase__      :			Tuple   =	""""""
      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 	lowercase_				(			__UpperCAmelCase				)						->    dict[str, str]:
      lowerCAmelCase__      :			Optional[int]   =	[chr(i + 65				) for i in range(26				)]
      # Remove duplicate characters from key
      lowerCAmelCase__      :			Dict   =	remove_duplicates(key.upper()				)
      lowerCAmelCase__      :			Tuple   =	len(__UpperCAmelCase				)
      # First fill cipher with key characters
      lowerCAmelCase__      :			Optional[int]   =	{alphabet[i]: char for i, char in enumerate(__UpperCAmelCase				)}
      # Then map remaining characters in alphabet to
      # the alphabet from the beginning
      for i in range(len(__UpperCAmelCase				)    ,		26				):
            lowerCAmelCase__      :			Union[str, Any]   =	alphabet[i - offset]
            # Ensure we are not mapping letters to letters previously mapped
            while char in key:
                  offset -= 1
                  lowerCAmelCase__      :			Optional[Any]   =	alphabet[i - offset]
            lowerCAmelCase__      :			Optional[int]   =	char
      return cipher_alphabet



def 	lowercase_				(			__UpperCAmelCase    ,		__UpperCAmelCase				)						->    str:
      return "".join(cipher_map.get(__UpperCAmelCase    ,		__UpperCAmelCase				) for ch in message.upper()				)



def 	lowercase_				(			__UpperCAmelCase    ,		__UpperCAmelCase				)						->    str:
      lowerCAmelCase__      :			Optional[int]   =	{v: k for k, v in cipher_map.items()}
      return "".join(rev_cipher_map.get(__UpperCAmelCase    ,		__UpperCAmelCase				) for ch in message.upper()				)



def 	lowercase_				(			)						->    None:
      lowerCAmelCase__      :			Dict   =	input("""Enter message to encode or decode: """				).strip()
      lowerCAmelCase__      :			Dict   =	input("""Enter keyword: """				).strip()
      lowerCAmelCase__      :			int   =	input("""Encipher or decipher? E/D:"""				).strip()[0].lower()
      try:
            lowerCAmelCase__      :			Optional[int]   =	{"""e""": encipher, """d""": decipher}[option]
      except KeyError:
            raise KeyError("""invalid input option"""				)
      lowerCAmelCase__      :			str   =	create_cipher_map(__UpperCAmelCase				)
      print(func(__UpperCAmelCase    ,		__UpperCAmelCase				)				)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  main()











"""simple docstring"""


# This is the module that test_patching.py uses to test patch_submodule()

import os  # noqa: this is just for tests
import os as renamed_os  # noqa: this is just for tests
from os import path  # noqa: this is just for tests
from os import path as renamed_path  # noqa: this is just for tests
from os.path import join  # noqa: this is just for tests
from os.path import join as renamed_join  # noqa: this is just for tests


_A													=      open  # noqa: we just need to have a builtin inside this module to test it properly





