



'''simple docstring'''

def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						str							,		_SCREAMING_SNAKE_CASE					:						str							)      ->						bool:







	"""simple docstring"""
	lowerCAmelCase   =     len(_SCREAMING_SNAKE_CASE							) + 1
	lowerCAmelCase   =     len(_SCREAMING_SNAKE_CASE							) + 1

	# dp is a 2d matrix where dp[i][j] denotes whether prefix string of
	# length i of input_string matches with prefix string of length j of
	# given pattern.
	# "dp" stands for dynamic programming.
	lowerCAmelCase   =     [[0 for i in range(_SCREAMING_SNAKE_CASE							)] for j in range(_SCREAMING_SNAKE_CASE							)]

	# since string of zero length match pattern of zero length
	lowerCAmelCase   =     1

	# since pattern of zero length will never match with string of non-zero length
	for i in range(1							,		_SCREAMING_SNAKE_CASE							):
		lowerCAmelCase   =     0

	# since string of zero length will match with pattern where there
	# is at least one * alternatively
	for j in range(1							,		_SCREAMING_SNAKE_CASE							):
		lowerCAmelCase   =     dp[0][j - 2] if pattern[j - 1] == """*""" else 0

	# now using bottom-up approach to find for all remaining lengths
	for i in range(1							,		_SCREAMING_SNAKE_CASE							):
		for j in range(1							,		_SCREAMING_SNAKE_CASE							):
			if input_string[i - 1] == pattern[j - 1] or pattern[j - 1] == ".":
				lowerCAmelCase   =     dp[i - 1][j - 1]

			elif pattern[j - 1] == "*":
				if dp[i][j - 2] == 1:
					lowerCAmelCase   =     1
				elif pattern[j - 2] in (input_string[i - 1], "."):
					lowerCAmelCase   =     dp[i - 1][j]
				else:
					lowerCAmelCase   =     0
			else:
				lowerCAmelCase   =     0

	return bool(dp[-1][-1]							)


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				# inputing the strings
				# input_string = input("input a string :")
				# pattern = input("input a pattern :")

				UpperCAmelCase     		=   'aab'
				UpperCAmelCase     		=   'c*a*b'

				# using function to check whether given string matches the given pattern
				if match_pattern(input_string, pattern):
								print(F'''{input_string} matches the given pattern {pattern}''')
				else:
								print(F'''{input_string} does not match with the given pattern {pattern}''')




'''simple docstring'''

from __future__ import annotations

class __snake_case:


						'''simple docstring'''



						def __init__( self     ,	A_ = 0				)     ->     Dict:
							lowerCAmelCase   =     key


						def     __snake_case   ( self     ,	A_     ,	A_				)     ->     list[str]:
							assert isinstance(A_     ,	A_				) and isinstance(A_     ,	A_				)

							lowerCAmelCase   =     key or self.__key or 1

							# make sure key is an appropriate size
							key %= 255

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


						def     __snake_case   ( self     ,	A_     ,	A_				)     ->     list[str]:
							assert isinstance(A_     ,	A_				) and isinstance(A_     ,	A_				)

							lowerCAmelCase   =     key or self.__key or 1

							# make sure key is an appropriate size
							key %= 255

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


						def     __snake_case   ( self     ,	A_     ,	A_ = 0				)     ->     str:
							assert isinstance(A_     ,	A_				) and isinstance(A_     ,	A_				)

							lowerCAmelCase   =     key or self.__key or 1

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

							# This will be returned
							lowerCAmelCase   =     """"""

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

							return ans


						def     __snake_case   ( self     ,	A_     ,	A_ = 0				)     ->     str:
							assert isinstance(A_     ,	A_				) and isinstance(A_     ,	A_				)

							lowerCAmelCase   =     key or self.__key or 1

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

							# This will be returned
							lowerCAmelCase   =     """"""

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

							return ans


						def     __snake_case   ( self     ,	A_     ,	A_ = 0				)     ->     bool:
							assert isinstance(A_     ,	A_				) and isinstance(A_     ,	A_				)

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

							except OSError:
								return False

							return True




						def     __snake_case   ( self     ,	A_     ,	A_				)     ->     bool:
							assert isinstance(A_     ,	A_				) and isinstance(A_     ,	A_				)

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

							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")