


"""simple docstring"""


def _lowerCamelCase      (						_UpperCamelCase ):

			'''simple docstring'''




			__lowerCAmelCase							       =     ""
			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 _lowerCamelCase      (						_UpperCamelCase ):

			'''simple docstring'''




			__lowerCAmelCase							       =     [chr(i + 65 ) for i in range(26 )]
			# Remove duplicate characters from key
			__lowerCAmelCase							       =     remove_duplicates(key.upper() )
			__lowerCAmelCase							       =     len(_UpperCamelCase )
			# First fill cipher with key characters
			__lowerCAmelCase							       =     {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							       =     alphabet[i - offset]
						# Ensure we are not mapping letters to letters previously mapped
						while char in key:
									offset -= 1
									__lowerCAmelCase							       =     alphabet[i - offset]
						__lowerCAmelCase							       =     char
			return cipher_alphabet


def _lowerCamelCase      (						_UpperCamelCase       ,					_UpperCamelCase ):

			'''simple docstring'''




			return "".join(cipher_map.get(_UpperCamelCase       ,					_UpperCamelCase ) for ch in message.upper() )


def _lowerCamelCase      (						_UpperCamelCase       ,					_UpperCamelCase ):

			'''simple docstring'''




			__lowerCAmelCase							       =     {v: k for k, v in cipher_map.items()}
			return "".join(rev_cipher_map.get(_UpperCamelCase       ,					_UpperCamelCase ) for ch in message.upper() )


def _lowerCamelCase      (						):

			'''simple docstring'''




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


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	main()








"""simple docstring"""


from __future__ import annotations
class     _UpperCamelCase    :
							'''simple docstring'''







							def __init__(	self       ,  __a=None      ):
										__lowerCAmelCase							       =     data
										__lowerCAmelCase							       =     None



							def __repr__(	self      ):
										__lowerCAmelCase							       =     []
										__lowerCAmelCase							       =     self
										while temp:
													string_rep.append(f"{temp.data}"      )
													__lowerCAmelCase							       =     temp.next
										return "->".join(__a      )


def _lowerCamelCase      (						_UpperCamelCase ):

			'''simple docstring'''




			if not elements_list:
						raise Exception("The Elements List is empty" )

			__lowerCAmelCase							       =     __lowerCAmelCase							       =     Node(elements_list[0] )
			for i in range(1       ,					len(_UpperCamelCase ) ):
						__lowerCAmelCase							       =     Node(elements_list[i] )
						__lowerCAmelCase							       =     current.next
			return head


def _lowerCamelCase      (						_UpperCamelCase ):

			'''simple docstring'''




			if head_node is not None and isinstance(_UpperCamelCase       ,					_UpperCamelCase ):
						print_reverse(head_node.next )
						print(head_node.data )


def _lowerCamelCase      (						):

			'''simple docstring'''




			from doctest import testmod

			testmod()

			__lowerCAmelCase							       =     make_linked_list([14, 52, 14, 12, 43] )
			print("Linked List:" )
			print(_UpperCamelCase )
			print("Elements in Reverse:" )
			print_reverse(_UpperCamelCase )


if __name__ == "__main__":
	main()




