


def A_					(				__SCREAMING_SNAKE_CASE :					str	,   __SCREAMING_SNAKE_CASE :					str       )     ->  str:
					if not isinstance(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE       ):
										raise TypeError('''plaintext must be a string'''       )
					if not isinstance(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE       ):
										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
					__SCREAMING_SNAKE_CASE					:							List[Any]			   = plaintext.lower()
					__SCREAMING_SNAKE_CASE					:							Optional[Any]			   = key.lower()
					__SCREAMING_SNAKE_CASE					:							Optional[int]			   = 0
					__SCREAMING_SNAKE_CASE					:							Union[str, Any]			   = 0
					__SCREAMING_SNAKE_CASE					:							Optional[int]			   = ''''''
					while plaintext_iterator < len(__SCREAMING_SNAKE_CASE       ):
										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_					(				__SCREAMING_SNAKE_CASE :					str	,   __SCREAMING_SNAKE_CASE :					str       )     ->  str:
					if not isinstance(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE       ):
										raise TypeError('''ciphertext must be a string'''       )
					if not isinstance(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE       ):
										raise TypeError('''key must be a string'''       )

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

					__SCREAMING_SNAKE_CASE					:							Optional[int]			   = key.lower()
					__SCREAMING_SNAKE_CASE					:							Tuple			   = 0
					__SCREAMING_SNAKE_CASE					:							Optional[Any]			   = 0
					__SCREAMING_SNAKE_CASE					:							List[str]			   = ''''''
					while ciphertext_iterator < len(__SCREAMING_SNAKE_CASE       ):
										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()
						_A      =     int(input("""Type 1 to encrypt or 2 to decrypt:"""))
						if operation == 1:
												_A      =     input("""Typeplaintext to be encrypted:\n""")
												_A      =     input("""Type the key:\n""")
												print(encrypt(plaintext, key))
						elif operation == 2:
												_A      =     input("""Type the ciphertext to be decrypted:\n""")
												_A      =     input("""Type the key:\n""")
												print(decrypt(ciphertext, key))
						decrypt("""jsqqs avvwo""", """coffee""")






'''simple docstring'''






# this script builds a small sample spm file tests/fixtures/test_sentencepiece_no_bos.model, with features needed by pegasus

# 1. pip install sentencepiece
#
# 2. wget https://raw.githubusercontent.com/google/sentencepiece/master/data/botchan.txt

# 3. build
import sentencepiece as spm

# pegasus:
# 1. no bos
# 2. eos_id is 1
# 3. unk_id is 2
# build a sample spm file accordingly
spm.SentencePieceTrainer.train(
    """--input=botchan.txt --model_prefix=test_sentencepiece_no_bos --bos_id=-1 --unk_id=2  --eos_id=1  --vocab_size=1000"""
)

# 4. now update the fixture
# mv test_sentencepiece_no_bos.model ../../tests/fixtures/


