




from __future__ import annotations




class    __lowerCAmelCase       :






       def __init__(   self:					Dict       ,					_lowerCAmelCase:					int = 0				):
         lowercase    :Union[str, Any]      	=						key






       def 					SCREAMING_SNAKE_CASE    (   self:					Optional[Any]       ,					_lowerCAmelCase:					str       ,					_lowerCAmelCase:					int				):
         assert isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				) and isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				)

         lowercase    :str      	=						key or self.__key or 1

         # make sure key is an appropriate size
         key %= 2_55

         return [chr(ord(_lowerCAmelCase				) ^ key				) for ch in content]






       def 					SCREAMING_SNAKE_CASE    (   self:					Union[str, Any]       ,					_lowerCAmelCase:					str       ,					_lowerCAmelCase:					int				):
         assert isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				) and isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				)

         lowercase    :Optional[int]      	=						key or self.__key or 1

         # make sure key is an appropriate size
         key %= 2_55

         return [chr(ord(_lowerCAmelCase				) ^ key				) for ch in content]






       def 					SCREAMING_SNAKE_CASE    (   self:					Tuple       ,					_lowerCAmelCase:					str       ,					_lowerCAmelCase:					int = 0				):
         assert isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				) and isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				)

         lowercase    :Dict      	=						key or self.__key or 1

         # make sure key can be any size
         while key > 2_55:
           key -= 2_55

         # This will be returned
         lowercase    :Dict      	=						""

         for ch in content:
           ans += chr(ord(_lowerCAmelCase				) ^ key				)

         return ans






       def 					SCREAMING_SNAKE_CASE    (   self:					List[str]       ,					_lowerCAmelCase:					str       ,					_lowerCAmelCase:					int = 0				):
         assert isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				) and isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				)

         lowercase    :List[Any]      	=						key or self.__key or 1

         # make sure key can be any size
         while key > 2_55:
           key -= 2_55

         # This will be returned
         lowercase    :Optional[int]      	=						""

         for ch in content:
           ans += chr(ord(_lowerCAmelCase				) ^ key				)

         return ans






       def 					SCREAMING_SNAKE_CASE    (   self:					List[Any]       ,					_lowerCAmelCase:					str       ,					_lowerCAmelCase:					int = 0				):
         assert isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				) and isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				)

         try:
           with open(_lowerCAmelCase				) as fin, open("encrypt.out"       ,					"w+"				) as fout:
             # actual encrypt-process
             for line in fin:
               fout.write(self.encrypt_string(_lowerCAmelCase       ,					_lowerCAmelCase				)				)

         except OSError:
           return False

         return True






       def 					SCREAMING_SNAKE_CASE    (   self:					int       ,					_lowerCAmelCase:					str       ,					_lowerCAmelCase:					int				):
         assert isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				) and isinstance(_lowerCAmelCase       ,					_lowerCAmelCase				)

         try:
           with open(_lowerCAmelCase				) as fin, open("decrypt.out"       ,					"w+"				) as fout:
             # actual encrypt-process
             for line in fin:
               fout.write(self.decrypt_string(_lowerCAmelCase       ,					_lowerCAmelCase				)				)

         except OSError:
           return False

         return True


# Tests
# crypt = XORCipher()
# key = 67

# # test encrypt
# print(crypt.encrypt("hallo welt",key))
# # test decrypt
# print(crypt.decrypt(crypt.encrypt("hallo welt",key), key))

# # test encrypt_string
# print(crypt.encrypt_string("hallo welt",key))

# # test decrypt_string
# print(crypt.decrypt_string(crypt.encrypt_string("hallo welt",key),key))

# if (crypt.encrypt_file("test.txt",key)):
#       print("encrypt successful")
# else:
#       print("encrypt unsuccessful")

# if (crypt.decrypt_file("encrypt.out",key)):
#       print("decrypt successful")
# else:
#       print("decrypt unsuccessful")









def       UpperCAmelCase__  (     lowerCamelCase,			lowerCamelCase   ):
  return int((input_a, input_a).count(0   ) != 0   )



def       UpperCAmelCase__  (     ):
  assert nand_gate(0,			0   ) == 1
  assert nand_gate(0,			1   ) == 1
  assert nand_gate(1,			0   ) == 1
  assert nand_gate(1,			1   ) == 0


if __name__ == "__main__":
     print(nand_gate(0, 0))
     print(nand_gate(0, 1))
     print(nand_gate(1, 0))
     print(nand_gate(1, 1))



