






def    a__    (	A		,					A       ):
   if not isinstance(A		,					A       ):
      raise TypeError("""plaintext must be a string"""       )
   if not isinstance(A		,					A       ):
      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__    :						Dict       =			plaintext.lower()
   lowercase__    :						Any       =			key.lower()
   lowercase__    :						Optional[Any]       =			0
   lowercase__    :						int       =			0
   lowercase__    :						str       =			""""""
   while plaintext_iterator < len(A       ):
      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__    (	A		,					A       ):
   if not isinstance(A		,					A       ):
      raise TypeError("""ciphertext must be a string"""       )
   if not isinstance(A		,					A       ):
      raise TypeError("""key must be a string"""       )

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

   lowercase__    :						str       =			key.lower()
   lowercase__    :						Union[str, Any]       =			0
   lowercase__    :						Optional[Any]       =			0
   lowercase__    :						Any       =			""""""
   while ciphertext_iterator < len(A       ):
      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()
 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')










from __future__ import annotations

from PIL import Image

# Define the first generation of cells
# fmt: off
a 			=							[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
def    a__    (	A       ):
   return [int(A       ) for c in F'''{ruleset:08}'''[:8]]
def    a__    (	A		,					A		,					A       ):
   lowercase__    :						List[Any]       =			len(cells[0]       )  # 31
   lowercase__    :						int       =			[]
   for i in range(A       ):
      # Get the neighbors of each cell
      # Handle neighbours outside bounds by using 0 as their value
      lowercase__    :						Optional[Any]       =			0 if i == 0 else cells[time][i - 1]
      lowercase__    :						Dict       =			0 if i == population - 1 else cells[time][i + 1]
      # Define a new cell and add it to the new generation
      lowercase__    :						str       =			7 - int(F'''{left_neighbor}{cells[time][i]}{right_neighbor}'''		,					2       )
      next_generation.append(rule[situation]       )
   return next_generation
def    a__    (	A       ):
   lowercase__    :						Tuple       =			Image.new("""RGB"""		,					(len(cells[0]       ), len(A       ))       )
   lowercase__    :						Optional[Any]       =			img.load()
   # Generates image
   for w in range(img.width       ):
      for h in range(img.height       ):
         lowercase__    :						Union[str, Any]       =			255 - int(255 * cells[h][w]       )
         lowercase__    :						int       =			(color, color, color)
   return img


if __name__ == "__main__":
 a 			=							bin(int(input('Rule:\n').strip()))[2:]
 a 			=							format_ruleset(int(rule_num))
 for time in range(16):
  CELLS.append(new_generation(CELLS, rule, time))
 a 			=							generate_image(CELLS)
 # Uncomment to save the image
 # img.save(f"rule_{rule_num}.png")
 img.show()


