


def       a_ (       SCREAMING_SNAKE_CASE__   : Tuple	):
       '''simple docstring'''





       _lowerCamelCase			:						Optional[Any]            =[]
       _lowerCamelCase			:						Any            =[]
       _lowerCamelCase			:						Union[str, Any]            ={
           '^': 3,
           '*': 2,
           '/': 2,
           '%': 2,
           '+': 1,
           '-': 1,
       }  # Priority of each operator
       _lowerCamelCase			:						Optional[int]            =len(SCREAMING_SNAKE_CASE__	) if (len(SCREAMING_SNAKE_CASE__	) > 7) else 7

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

       for x in infix:
              if x.isalpha() or x.isdigit():
                     post_fix.append(SCREAMING_SNAKE_CASE__	)  # if x is Alphabet / Digit, add it to Postfix
              elif x == "(":
                     stack.append(SCREAMING_SNAKE_CASE__	)  # 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(SCREAMING_SNAKE_CASE__	) == 0:
                            stack.append(SCREAMING_SNAKE_CASE__	)  # If stack is empty, push x to stack
                     else:  # while priority of x is not > priority of element in the stack
                            while len(SCREAMING_SNAKE_CASE__	) > 0 and priority[x] <= priority[stack[-1]]:
                                   post_fix.append(stack.pop()	)  # pop stack & add to Postfix
                            stack.append(SCREAMING_SNAKE_CASE__	)  # push x to stack

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

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

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




def       a_ (       SCREAMING_SNAKE_CASE__   : Tuple	):
       '''simple docstring'''





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

       for i in range(len(SCREAMING_SNAKE_CASE__	)	):
              if infix[i] == "(":
                     _lowerCamelCase			:						Any            =')'  # change "(" to ")"
              elif infix[i] == ")":
                     _lowerCamelCase			:						Any            ='('  # change ")" to "("

       return (infix_2_postfix(''.join(SCREAMING_SNAKE_CASE__	)	))[
           ::-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)')






from timeit import timeit

lowerCamelCase		   =			{
    'MALAYALAM': True,
    'String': False,
    'rotor': True,
    'level': True,
    'A': True,
    'BB': True,
    'ABC': False,
    'amanaplanacanalpanama': True,  # "a man a plan a canal panama"
}
# Ensure our test data is valid
assert all((key == key[::-1]) is value for key, value in test_data.items())




def       a_ (       SCREAMING_SNAKE_CASE__   : str	):
       '''simple docstring'''





       _lowerCamelCase			:						Optional[int]            =0
       _lowerCamelCase			:						Union[str, Any]            =len(SCREAMING_SNAKE_CASE__	) - 1
       while start_i < end_i:
              if s[start_i] == s[end_i]:
                     start_i += 1
                     end_i -= 1
              else:
                     return False
       return True




def       a_ (       SCREAMING_SNAKE_CASE__   : str	):
       '''simple docstring'''





       _lowerCamelCase			:						List[str]            =len(SCREAMING_SNAKE_CASE__	) // 2
       _lowerCamelCase			:						Optional[Any]            =len(SCREAMING_SNAKE_CASE__	)

       # We need to traverse till half of the length of string
       # as we can get access of the i'th last element from
       # i'th index.
       # eg: [0,1,2,3,4,5] => 4th index can be accessed
       # with the help of 1st index (i==n-i-1)
       # where n is length of string
       return all(s[i] == s[n - i - 1] for i in range(SCREAMING_SNAKE_CASE__	)	)




def       a_ (       SCREAMING_SNAKE_CASE__   : str	):
       '''simple docstring'''





       if len(SCREAMING_SNAKE_CASE__	) <= 2:
              return True
       if s[0] == s[len(SCREAMING_SNAKE_CASE__	) - 1]:
              return is_palindrome_recursive(s[1:-1]	)
       else:
              return False




def       a_ (       SCREAMING_SNAKE_CASE__   : str	):
       '''simple docstring'''





       return s == s[::-1]




def       a_ (       SCREAMING_SNAKE_CASE__   : str	):
       '''simple docstring'''





       _lowerCamelCase			:						Optional[int]            =F'''all({name}(key) is value for key, value in test_data.items())'''
       _lowerCamelCase			:						List[Any]            =F'''from __main__ import test_data, {name}'''
       _lowerCamelCase			:						Any            =500_000
       _lowerCamelCase			:						Dict            =timeit(stmt=SCREAMING_SNAKE_CASE__						,     setup=SCREAMING_SNAKE_CASE__						,     number=SCREAMING_SNAKE_CASE__	)
       print(F'''{name:<35} finished {number:,} runs in {result:.5f} seconds'''	)


if __name__ == "__main__":
 for key, value in test_data.items():
  assert is_palindrome(key) is is_palindrome_recursive(key)
  assert is_palindrome(key) is is_palindrome_slice(key)
  print(F"""{key:21} {value}""")
 print('a man a plan a canal panama')

 # finished 500,000 runs in 0.46793 seconds
 benchmark_function('is_palindrome_slice')
 # finished 500,000 runs in 0.85234 seconds
 benchmark_function('is_palindrome')
 # finished 500,000 runs in 1.32028 seconds
 benchmark_function('is_palindrome_recursive')
 # finished 500,000 runs in 2.08679 seconds
 benchmark_function('is_palindrome_traversal')


