




'''simple docstring'''


def 		snake_case_    (UpperCamelCase       :  str ,						UpperCamelCase       :  str      ):





							'''simple docstring'''


							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
							_a	     =				plaintext.lower()
							_a	     =				key.lower()
							_a	     =				0
							_a	     =				0
							_a	     =				''''''
							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 		snake_case_    (UpperCamelCase       :  str ,						UpperCamelCase       :  str      ):





							'''simple docstring'''


							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'''      )

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







'''simple docstring'''


from __future__ import annotations
def 		snake_case_    (UpperCamelCase       :  int      ):





							'''simple docstring'''


							_a	     =				[0] * max_one

							for i in range(0 ,						UpperCamelCase      ):
														_a	     =				i

							for i in range(2 ,						UpperCamelCase      ):
														if totients[i] == i:
																					for j in range(UpperCamelCase ,						UpperCamelCase ,						UpperCamelCase      ):
																												totients[j] -= totients[j] // i

							return totients
def 		snake_case_    (UpperCamelCase       :  int ,						UpperCamelCase       :  int      ):





							'''simple docstring'''


							return sorted(str(UpperCamelCase      )      ) == sorted(str(UpperCamelCase      )      )
def 		snake_case_    (UpperCamelCase       :  int = 1000_0000      ):





							'''simple docstring'''


							_a	     =				1  # i
							_a	     =				0  # φ(i)
							_a	     =				get_totients(max_n + 1      )

							for i in range(2 ,						max_n + 1      ):
														_a	     =				totients[i]

														if i * min_denominator < min_numerator * t and has_same_digits(UpperCamelCase ,						UpperCamelCase      ):
																					_a	     =				i
																					_a	     =				t

							return min_numerator


if __name__ == "__main__":
				print(F'''{solution() = }''')

