input: Write a python function to convert an infix expression to a postfix expression.
  assert infix_to_postfix("3 + 4 * 2") == "3 4 2 * +"
  assert infix_to_postfix("7 + 8 - 3 * 4") == "7 8 + 3 4 * -"
  assert infix_to_postfix("10 + 2 * 6") == "10 2 6 * +"
output: def infix_to_postfix(expression):
      precedence = {'+': 1, '-': 1, '*': 2, '/': 2, '^': 3}
      def has_higher_precedence(op1, op2):
          return precedence[op1] >= precedence[op2]
  
      output = []
      stack = []
  
      for token in expression.split():
          if token.isnumeric():
              output.append(token)
          elif token in precedence:
              while stack and stack[-1] in precedence and has_higher_precedence(stack[-1], token):
                  output.append(stack.pop())
              stack.append(token)
          else:
              raise ValueError("Invalid character in expression")
  
      while stack:
          output.append(stack.pop())
  
      return ' '.join(output)