



def  __lowerCamelCase (       lowerCamelCase__					,			lowerCamelCase__						):

    """simple docstring"""


    lowercase__					:   Tuple													=					len(lowerCamelCase__						) + 1
    lowercase__					:   str													=					len(lowerCamelCase__						) + 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.
    lowercase__					:   Any													=					[[0 for i in range(lowerCamelCase__						)] for j in range(lowerCamelCase__						)]

    # since string of zero length match pattern of zero length
    lowercase__					:   Union[str, Any]													=					1

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

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

            elif pattern[j - 1] == "*":
                if dp[i][j - 2] == 1:
                    lowercase__					:   str													=					1
                elif pattern[j - 2] in (input_string[i - 1], "."):
                    lowercase__					:   int													=					dp[i - 1][j]
                else:
                    lowercase__					:   Dict													=					0
            else:
                lowercase__					:   Optional[Any]													=					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 :")

    lowerCAmelCase__					  =  '''aab'''
    lowerCAmelCase__					  =  '''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}''')









def  __lowerCamelCase (       lowerCamelCase__						):

				"""simple docstring"""


				lowercase__					:   Union[str, Any]													=					[]
				lowercase__					:   Tuple													=					[]
				lowercase__					:   Any													=					{
				    "^": 3,
				    "*": 2,
				    "/": 2,
				    "%": 2,
				    "+": 1,
				    "-": 1,
				}  # Priority of each operator
				lowercase__					:   Any													=					len(lowerCamelCase__						) if (len(lowerCamelCase__						) > 7) else 7

				# Print table header for output
				print(
				    "Symbol".center(8						)					,			"Stack".center(lowerCamelCase__						)					,			"Postfix".center(lowerCamelCase__						)					,			sep=" | "					,			)
				print("-" * (print_width * 3 + 7)						)

				for x in infix:
								if x.isalpha() or x.isdigit():
												post_fix.append(lowerCamelCase__						)  # if x is Alphabet / Digit, add it to Postfix
								elif x == "(":
												stack.append(lowerCamelCase__						)  # if x is "(" push to Stack
								elif x == ")":  # if x is ")" pop stack until "(" is encountered
												while stack[-1] != "(":
																post_fix.append(stack.pop()						)  # Pop stack & add the content to Postfix
												stack.pop()
								else:
												if len(lowerCamelCase__						) == 0:
																stack.append(lowerCamelCase__						)  # If stack is empty, push x to stack
												else:  # while priority of x is not > priority of element in the stack
																while len(lowerCamelCase__						) > 0 and priority[x] <= priority[stack[-1]]:
																				post_fix.append(stack.pop()						)  # pop stack & add to Postfix
																stack.append(lowerCamelCase__						)  # push x to stack

								print(
								    x.center(8						)					,			("".join(lowerCamelCase__						)).ljust(lowerCamelCase__						)					,			("".join(lowerCamelCase__						)).ljust(lowerCamelCase__						)					,			sep=" | "					,			)  # Output in tabular format

				while len(lowerCamelCase__						) > 0:  # while stack is not empty
								post_fix.append(stack.pop()						)  # pop stack & add to Postfix
								print(
								    " ".center(8						)					,			("".join(lowerCamelCase__						)).ljust(lowerCamelCase__						)					,			("".join(lowerCamelCase__						)).ljust(lowerCamelCase__						)					,			sep=" | "					,			)  # Output in tabular format

				return "".join(lowerCamelCase__						)  # return Postfix as str


def  __lowerCamelCase (       lowerCamelCase__						):

				"""simple docstring"""


				lowercase__					:   Optional[int]													=					list(infix[::-1]						)  # reverse the infix equation

				for i in range(len(lowerCamelCase__						)						):
								if infix[i] == "(":
												lowercase__					:   Tuple													=					")"  # change "(" to ")"
								elif infix[i] == ")":
												lowercase__					:   Optional[Any]													=					"("  # change ")" to "("

				return (infix_2_postfix("".join(lowerCamelCase__						)						))[
				    ::-1
				]  # call infix_2_postfix on Infix, return reverse of Postfix


if __name__ == "__main__":
				lowerCAmelCase__					  =  input('''\nEnter an Infix Equation = ''')  # Input an Infix equation
				lowerCAmelCase__					  =  ''''''.join(Infix.split())  # Remove spaces from the input
				print('''\n\t''', Infix, '''(Infix) -> ''', infix_2_prefix(Infix), '''(Prefix)''')




