


def  __snake_case       (   UpperCamelCase__ ,			UpperCamelCase__	)      ->		bool:







		"""simple docstring"""





		A					       = len(UpperCamelCase__	) + 1
		A					       = len(UpperCamelCase__	) + 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.
		A					       = [[0 for i in range(UpperCamelCase__	)] for j in range(UpperCamelCase__	)]

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

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

		# since string of zero length will match with pattern where there
		# is at least one * alternatively
		for j in range(1 ,			UpperCamelCase__	):
				A					       = 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 ,			UpperCamelCase__	):
				for j in range(1 ,			UpperCamelCase__	):
						if input_string[i - 1] == pattern[j - 1] or pattern[j - 1] == ".":
								A					       = dp[i - 1][j - 1]

						elif pattern[j - 1] == "*":
								if dp[i][j - 2] == 1:
										A					       = 1
								elif pattern[j - 2] in (input_string[i - 1], "."):
										A					       = dp[i - 1][j]
								else:
										A					       = 0
						else:
								A					       = 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						:				Optional[Any]             =      "aab"
	UpperCamelCase						:				List[Any]             =      "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 math import factorial







def  __snake_case       (   UpperCamelCase__ ,			UpperCamelCase__ ,			UpperCamelCase__	)      ->		float:







		"""simple docstring"""





		if successes > trials:
				raise ValueError('successes must be lower or equal to trials'	)
		if trials < 0 or successes < 0:
				raise ValueError('the function is defined for non-negative integers'	)
		if not isinstance(UpperCamelCase__ ,			UpperCamelCase__	) or not isinstance(UpperCamelCase__ ,			UpperCamelCase__	):
				raise ValueError('the function is defined for non-negative integers'	)
		if not 0 < prob < 1:
				raise ValueError('prob has to be in range of 1 - 0'	)
		A					       = (prob**successes) * ((1 - prob) ** (trials - successes))
		# Calculate the binomial coefficient: n! / k!(n-k)!
		A					       = float(factorial(UpperCamelCase__	)	)
		coefficient /= factorial(UpperCamelCase__	) * factorial(trials - successes	)
		return probability * coefficient


if __name__ == "__main__":
	from doctest import testmod

	testmod()
	print("Probability of 2 successes out of 4 trails")
	print("with probability of 0.75 is:", end=" ")
	print(binomial_distribution(2, 4, 0.75))





