


def   UpperCamelCase__   (    UpperCAmelCase_    ,     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
       _lowercase					:				List[Any]           =			plaintext.lower()
       _lowercase					:				str           =			key.lower()
       _lowercase					:				str           =			0
       _lowercase					:				Dict           =			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   UpperCamelCase__   (    UpperCAmelCase_    ,     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'''			)

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



import torch
import torch.nn as nn
from transformers.modeling_utils import ModuleUtilsMixin
from transformers.models.ta.modeling_ta import (
    TaBlock,
    TaConfig,
    TaLayerNorm,
)

from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin

class 						UpperCAmelCase__   (      A_      ,						A_      ,						A_		):



     '''simple docstring'''




     @register_to_config
     def __init__( self       :       Dict	,      UpperCamelCase       :       int	,      UpperCamelCase       :       int	,      UpperCamelCase       :       int	,      UpperCamelCase       :       float	,      UpperCamelCase       :       int	,      UpperCamelCase       :       int	,      UpperCamelCase       :       int	,      UpperCamelCase       :       int	,      UpperCamelCase       :       str	,      UpperCamelCase       :       bool = False	,      ):





            """simple docstring"""



            super().__init__()

            _lowercase					:				Any           =			nn.Linear(UpperCamelCase	,      UpperCamelCase	,      bias=UpperCamelCase		)

            _lowercase					:				List[Any]           =			nn.Embedding(UpperCamelCase	,      UpperCamelCase		)
            _lowercase					:				Any           =			False

            _lowercase					:				Tuple           =			nn.Dropout(p=UpperCamelCase		)

            _lowercase					:				Any           =			TaConfig(
                d_model=UpperCamelCase	,      num_heads=UpperCamelCase	,      d_kv=UpperCamelCase	,      d_ff=UpperCamelCase	,      feed_forward_proj=UpperCamelCase	,      dropout_rate=UpperCamelCase	,      is_decoder=UpperCamelCase	,      is_encoder_decoder=UpperCamelCase	,      )
            _lowercase					:				Any           =			nn.ModuleList()
            for lyr_num in range(UpperCamelCase		):
                   _lowercase					:				Tuple           =			TaBlock(UpperCamelCase		)
                   self.encoders.append(UpperCamelCase		)

            _lowercase					:				List[Any]           =			TaLayerNorm(UpperCamelCase		)
            _lowercase					:				Optional[Any]           =			nn.Dropout(p=UpperCamelCase		)




     def   lowerCAmelCase_   ( self       :       int	,      UpperCamelCase       :       Optional[int]	,      UpperCamelCase       :       List[Any]		):





            """simple docstring"""



            _lowercase					:				Optional[int]           =			self.input_proj(UpperCamelCase		)

            # terminal relative positional encodings
            _lowercase					:				Optional[int]           =			encoder_inputs.shape[1]
            _lowercase					:				Optional[int]           =			torch.arange(UpperCamelCase	,      device=encoder_inputs.device		)

            _lowercase					:				Any           =			encoder_inputs_mask.sum(-1		)
            _lowercase					:				int           =			torch.roll(input_positions.unsqueeze(0		)	,      tuple(seq_lens.tolist()		)	,      dims=0		)
            x += self.position_encoding(UpperCamelCase		)

            _lowercase					:				Optional[int]           =			self.dropout_pre(UpperCamelCase		)

            # inverted the attention mask
            _lowercase					:				Optional[int]           =			encoder_inputs.size()
            _lowercase					:				List[Any]           =			self.get_extended_attention_mask(UpperCamelCase	,      UpperCamelCase		)

            for lyr in self.encoders:
                   _lowercase					:				Optional[int]           =			lyr(UpperCamelCase	,      UpperCamelCase		)[0]
            _lowercase					:				List[str]           =			self.layer_norm(UpperCamelCase		)

            return self.dropout_post(UpperCamelCase		), encoder_inputs_mask