



"""simple docstring"""







def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		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				: List[str]     =   plaintext.lower()
		_lowercase				: str     =   key.lower()
		_lowercase				: Any     =   0
		_lowercase				: int     =   0
		_lowercase				: Any     =   """"""
		while plaintext_iterator < len(__UpperCAmelCase      ):
				if (
				    ord(plaintext[plaintext_iterator]      ) < 97
				    or ord(plaintext[plaintext_iterator]      ) > 122
				):
						ciphertext += plaintext[plaintext_iterator]
						plaintext_iterator += 1
				elif ord(key[key_iterator]      ) < 97 or ord(key[key_iterator]      ) > 122:
						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  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		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				: Dict     =   key.lower()
		_lowercase				: str     =   0
		_lowercase				: Dict     =   0
		_lowercase				: Optional[Any]     =   """"""
		while ciphertext_iterator < len(__UpperCAmelCase      ):
				if (
				    ord(ciphertext[ciphertext_iterator]      ) < 97
				    or ord(ciphertext[ciphertext_iterator]      ) > 122
				):
						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()
		UpperCAmelCase:  Any			     =				int(input("""Type 1 to encrypt or 2 to decrypt:"""))
		if operation == 1:
				UpperCAmelCase:  Any			     =				input("""Typeplaintext to be encrypted:\n""")
				UpperCAmelCase:  Dict			     =				input("""Type the key:\n""")
				print(encrypt(plaintext, key))
		elif operation == 2:
				UpperCAmelCase:  List[str]			     =				input("""Type the ciphertext to be decrypted:\n""")
				UpperCAmelCase:  Any			     =				input("""Type the key:\n""")
				print(decrypt(ciphertext, key))
		decrypt("""jsqqs avvwo""", """coffee""")







"""simple docstring"""
import doctest

import projectq
from projectq.ops import H, Measure







def     _a					(   _SCREAMING_SNAKE_CASE					)     ->					int:
							snake_case_     							=		quantum_engine.allocate_qubit()
							H | qubit
							Measure | qubit
							return int(_SCREAMING_SNAKE_CASE					)


if __name__ == "__main__":
				doctest.testmod()

				# initialises a new quantum backend
				__SCREAMING_SNAKE_CASE				:     Dict		=     projectq.MainEngine()

				# Generate a list of 10 random numbers
				__SCREAMING_SNAKE_CASE				:     Optional[Any]		=     [get_random_number(quantum_engine) for _ in range(10)]

				# Flushes the quantum engine from memory
				quantum_engine.flush()

				print('Random numbers', random_numbers_list)



