You are to write a C/C++ program that takes in arithmetic expressions in infix notation and transform to to postfix notation.
The expression will contain four operators: + (add), - (subtract), * (multiply), / (divide), as well as parentheses.
The expression will be in infix notation (e.g. "1+2", "(5+3-2)/6"), without any spaces between the operators and arguments.
Note arguments for each operator can be a parenthesized sub-expression or any non-negative integer. I.e. you can see "(1+(2-3))", but not "(-1+1*2)" or "((10*1)--2)", as -1 and -2 are negative integers.
You can assume that the expression will always be valid.
You can assume that the operator arguments are always in the range [4*10^9, -4*10^9], and can be stored in a "long" type variable.
You can also assume that each expression will be no longer than 10^6 characters long.
Your program MAY use C++ standard library headers.
A new line containing the number of arithmetic expressions to be evaluated ("M"), with the expressions starting on the next line, one expression per line.
"0 < M <= 10^6"
Sum of all expression lengths <= 2 * 10^6
The expression in postfix notation, one expression per line. Each expression should be newline ("\n") terminated, with arguments and operators separated by a single space.
Note: There should be NO extra space after the last token in the expression, or else you will get a presentation error!
Correct: "7 12 14 / -\n"
Presentation Error: "7 12 14 / - \n"