





"""simple docstring"""






from __future__ import annotations

from typing import Any



class 						lowerCAmelCase       :






       def __init__( self     ,	a__     ,	a__  ):  # noqa: A002
              _UpperCAmelCase			     =  item
              _UpperCAmelCase			     =  next



class 						lowerCAmelCase       :






       def __init__( self  ):
              _UpperCAmelCase			     =  None
              _UpperCAmelCase			     =  0






       def 				__A			( self     ,	a__  ):
              _UpperCAmelCase			     =  Node(a__     ,	self.head  )
              self.size += 1






       def 				__A			( self  ):
              # Switched 'self.is_empty()' to 'self.head is None'
              # because mypy was considering the possibility that 'self.head'
              # can be None in below else part and giving error
              if self.head is None:
                     return None
              else:
                     _UpperCAmelCase			     =  self.head.item
                     _UpperCAmelCase			     =  self.head.next
                     self.size -= 1
                     return item






       def 				__A			( self  ):
              return self.head is None






       def __str__( self  ):
              if self.is_empty():
                     return ""
              else:
                     _UpperCAmelCase			     =  self.head
                     _UpperCAmelCase			     =  ''
                     _UpperCAmelCase			     =  []
                     while iterate:
                            item_list.append(str(iterate.item  )  )
                            _UpperCAmelCase			     =  iterate.next

                     _UpperCAmelCase			     =  ' --> '.join(a__  )

                     return item_str






       def __len__( self  ):
              return self.size









"""simple docstring"""






def 		A_	(   __UpperCamelCase     :				str       ,	__UpperCamelCase     :				str				):
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''plaintext must be a string'''				)
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''key must be a string'''				)

		if not plaintext:
				raise ValueError('''plaintext is empty'''				)
		if not key:
				raise ValueError('''key is empty'''				)

		key += plaintext
		lowercase										=							plaintext.lower()
		lowercase										=							key.lower()
		lowercase										=							0
		lowercase										=							0
		lowercase										=							''''''
		while plaintext_iterator < len(__UpperCamelCase				):
				if (
				    ord(plaintext[plaintext_iterator]				) < 97
				    or ord(plaintext[plaintext_iterator]				) > 1_22
				):
						ciphertext += plaintext[plaintext_iterator]
						plaintext_iterator += 1
				elif ord(key[key_iterator]				) < 97 or ord(key[key_iterator]				) > 1_22:
						key_iterator += 1
				else:
						ciphertext += chr(
						    (
						        (ord(plaintext[plaintext_iterator]				) - 97 + ord(key[key_iterator]				))
						        - 97
						    )
						    % 26
						    + 97				)
						key_iterator += 1
						plaintext_iterator += 1
		return ciphertext
def 		A_	(   __UpperCamelCase     :				str       ,	__UpperCamelCase     :				str				):
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''ciphertext must be a string'''				)
		if not isinstance(__UpperCamelCase       ,	__UpperCamelCase				):
				raise TypeError('''key must be a string'''				)

		if not ciphertext:
				raise ValueError('''ciphertext is empty'''				)
		if not key:
				raise ValueError('''key is empty'''				)

		lowercase										=							key.lower()
		lowercase										=							0
		lowercase										=							0
		lowercase										=							''''''
		while ciphertext_iterator < len(__UpperCamelCase				):
				if (
				    ord(ciphertext[ciphertext_iterator]				) < 97
				    or ord(ciphertext[ciphertext_iterator]				) > 1_22
				):
						plaintext += ciphertext[ciphertext_iterator]
				else:
						plaintext += chr(
						    (ord(ciphertext[ciphertext_iterator]				) - ord(key[key_iterator]				)) % 26
						    + 97				)
						key += chr(
						    (ord(ciphertext[ciphertext_iterator]				) - ord(key[key_iterator]				)) % 26
						    + 97				)
						key_iterator += 1
				ciphertext_iterator += 1
		return plaintext


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							__lowerCAmelCase				      =   int(input('''Type 1 to encrypt or 2 to decrypt:'''))
							if operation == 1:
														__lowerCAmelCase				      =   input('''Typeplaintext to be encrypted:\n''')
														__lowerCAmelCase				      =   input('''Type the key:\n''')
														print(encrypt(plaintext, key))
							elif operation == 2:
														__lowerCAmelCase				      =   input('''Type the ciphertext to be decrypted:\n''')
														__lowerCAmelCase				      =   input('''Type the key:\n''')
														print(decrypt(ciphertext, key))
							decrypt('''jsqqs avvwo''', '''coffee''')