



"""simple docstring"""






def 					snake_case__       (		__lowerCamelCase    :   str     ):
   """simple docstring"""
   lowerCamelCase__		:		str		     =[]
   lowerCamelCase__		:		Optional[int]		     =[]
   lowerCamelCase__		:		Dict		     ={
       '''^''': 3,
       '''*''': 2,
       '''/''': 2,
       '''%''': 2,
       '''+''': 1,
       '''-''': 1,
   }  # Priority of each operator
   lowerCamelCase__		:		List[Any]		     =len(__A     ) if (len(__A     ) > 7) else 7

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

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

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

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

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






def 					snake_case__       (		__lowerCamelCase    :   List[Any]     ):
   """simple docstring"""
   lowerCamelCase__		:		Dict		     =list(infix[::-1]     )  # reverse the infix equation

   for i in range(len(__A     )     ):
      if infix[i] == "(":
         lowerCamelCase__		:		List[str]		     =''')'''  # change "(" to ")"
      elif infix[i] == ")":
         lowerCamelCase__		:		Optional[Any]		     ='''('''  # change ")" to "("

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


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









"""simple docstring"""






def 					snake_case__       (		__lowerCamelCase    :   int							,		__lowerCamelCase    :   int     ):
			"""simple docstring"""
			return int((input_a, input_a).count(0     ) != 0     )






def 					snake_case__       (		):
			"""simple docstring"""
			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))




