
"""simple docstring"""




def 						_snake_case(  SCREAMING_SNAKE_CASE__    )			->   str:
       lowercase							:					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 						_snake_case(  SCREAMING_SNAKE_CASE__    )			->   dict[str, str]:
       lowercase							:					Optional[int]	     =				[chr(i + 65    ) for i in range(26    )]
       # Remove duplicate characters from key
       lowercase							:					Optional[Any]	     =				remove_duplicates(key.upper()    )
       lowercase							:					str	     =				len(UpperCamelCase__    )
       # First fill cipher with key characters
       lowercase							:					List[str]	     =				{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    ):
              lowercase							:					Optional[Any]	     =				alphabet[i - offset]
              # Ensure we are not mapping letters to letters previously mapped
              while char in key:
                     offset -= 1
                     lowercase							:					str	     =				alphabet[i - offset]
              lowercase							:					Dict	     =				char
       return cipher_alphabet







def 						_snake_case(  SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__    )			->   str:
       return "".join(cipher_map.get(UpperCamelCase__ ,     UpperCamelCase__    ) for ch in message.upper()    )







def 						_snake_case(  SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__    )			->   str:
       lowercase							:					Union[str, Any]	     =				{v: k for k, v in cipher_map.items()}
       return "".join(rev_cipher_map.get(UpperCamelCase__ ,     UpperCamelCase__    ) for ch in message.upper()    )







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


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  main()


from __future__ import annotations

import numpy as np







def 						_snake_case(  SCREAMING_SNAKE_CASE__    )			->   tuple[np.ndarray, np.ndarray]:
       lowercase     ,      lowercase							:					Dict	     =				np.shape(SCREAMING_SNAKE_CASE__    )
       if rows != columns:
              lowercase							:					str	     =				(
                  """'table' has to be of square shaped array but got a """
                  f"{rows}x{columns} array:\n{table}"
              )
              raise ValueError(SCREAMING_SNAKE_CASE__    )

       lowercase							:					Any	     =				np.zeros((rows, columns)    )
       lowercase							:					int	     =				np.zeros((rows, columns)    )
       for i in range(SCREAMING_SNAKE_CASE__    ):
              for j in range(SCREAMING_SNAKE_CASE__    ):
                     lowercase							:					Optional[int]	     =				sum(lower[i][k] * upper[k][j] for k in range(SCREAMING_SNAKE_CASE__    )    )
                     if upper[j][j] == 0:
                            raise ArithmeticError("""No LU decomposition exists"""    )
                     lowercase							:					str	     =				(table[i][j] - total) / upper[j][j]
              lowercase							:					Optional[Any]	     =				1
              for j in range(SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__    ):
                     lowercase							:					Any	     =				sum(lower[i][k] * upper[k][j] for k in range(SCREAMING_SNAKE_CASE__    )    )
                     lowercase							:					Tuple	     =				table[i][j] - total
       return lower, upper


if __name__ == "__main__":
  import doctest

  doctest.testmod()
