




'''simple docstring'''






def 		a_( lowerCamelCase   ,				lowerCamelCase      )				->str:






       '''simple docstring'''




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






       '''simple docstring'''




       if not isinstance(lowerCamelCase   ,				lowerCamelCase      ):
              raise TypeError('''ciphertext must be a string'''      )
       if not isinstance(lowerCamelCase   ,				lowerCamelCase      ):
              raise TypeError('''key must be a string'''      )

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

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










'''simple docstring'''






import math
from timeit import timeit




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       lowercase  :		Dict						=      0
       lowercase  :		Union[str, Any]						=      abs(lowerCamelCase      )
       while True:
              lowercase  :		List[Any]						=      n // 10
              digits += 1
              if n == 0:
                     break
       return digits




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       return 1 if n == 0 else math.floor(math.log(abs(lowerCamelCase      )   ,				10      ) + 1      )




def 		a_( lowerCamelCase      )				->int:






       '''simple docstring'''




       return len(str(abs(lowerCamelCase      )      )      )




def 		a_( )				->None:






       '''simple docstring'''




       from collections.abc import Callable

       def benchmark_a_function(lowerCamelCase   ,				lowerCamelCase      ) -> None:
              lowercase  :		str						=      f"""{func.__name__}({value})"""
              lowercase  :		Optional[Any]						=      timeit(f"""__main__.{call}"""   ,				setup='''import __main__'''      )
              print(f"""{call}: {func(lowerCamelCase      )} -- {timing} seconds"""      )

       for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
              for func in (num_digits, num_digits_fast, num_digits_faster):
                     benchmark_a_function(lowerCamelCase   ,				lowerCamelCase      )
              print()


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      benchmark()




