


'''simple docstring'''





def 					a__    (				UpperCamelCase_	:			str,      UpperCamelCase_	:			str	):
   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
   UpperCAmelCase__  :Union[str, Any]            =			plaintext.lower()
   UpperCAmelCase__  :Tuple            =			key.lower()
   UpperCAmelCase__  :Optional[int]            =			0
   UpperCAmelCase__  :Dict            =			0
   UpperCAmelCase__  :int            =			''''''
   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 					a__    (				UpperCamelCase_	:			str,      UpperCamelCase_	:			str	):
   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'''	)

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







'''simple docstring'''





import heapq


def 					a__    (				UpperCamelCase_	:			Dict,      UpperCamelCase_	:			Tuple,      UpperCamelCase_	:			Dict	):
   UpperCAmelCase__  :List[Any]            =			[(0, start)]  # cost from start node,end node
   UpperCAmelCase__  :Optional[int]            =			set()
   while heap:
      ((UpperCAmelCase__)      ,	(UpperCAmelCase__))  :Optional[Any]            =			heapq.heappop(UpperCamelCase_	)
      if u in visited:
         continue
      visited.add(UpperCamelCase_	)
      if u == end:
         return cost
      for v, c in graph[u]:
         if v in visited:
            continue
         UpperCAmelCase__  :int            =			cost + c
         heapq.heappush(UpperCamelCase_,      (next_item, v)	)
   return -1


__lowerCamelCase       				=	{
    '''A''': [['''B''', 2], ['''C''', 5]],
    '''B''': [['''A''', 2], ['''D''', 3], ['''E''', 1], ['''F''', 1]],
    '''C''': [['''A''', 5], ['''F''', 3]],
    '''D''': [['''B''', 3]],
    '''E''': [['''B''', 4], ['''F''', 3]],
    '''F''': [['''C''', 3], ['''E''', 3]],
}
__lowerCamelCase       				=	{
    '''B''': [['''C''', 1]],
    '''C''': [['''D''', 1]],
    '''D''': [['''F''', 1]],
    '''E''': [['''B''', 1], ['''F''', 3]],
    '''F''': [],
}
__lowerCamelCase       				=	{
    '''B''': [['''C''', 1]],
    '''C''': [['''D''', 1]],
    '''D''': [['''F''', 1]],
    '''E''': [['''B''', 1], ['''G''', 2]],
    '''F''': [],
    '''G''': [['''F''', 1]],
}

__lowerCamelCase       				=	dijkstra(G, '''E''', '''C''')
print(short_distance)  # E -- 3 --> F -- 3 --> C == 6

__lowerCamelCase       				=	dijkstra(Ga, '''E''', '''F''')
print(short_distance)  # E -- 3 --> F == 3

__lowerCamelCase       				=	dijkstra(Ga, '''E''', '''F''')
print(short_distance)  # E -- 2 --> G -- 1 --> F == 3

if __name__ == "__main__":
    import doctest

    doctest.testmod()



