Read from standard input an arithmetic expression in postfix notation (reverse Polish notation), made up of natural numbers and the operators +, -, *, /. Tokens (numbers and operators) are separated by single spaces.
Compute the value of the expression using a stack of numbers implemented on an array with index top. The algorithm is:
- when you encounter a number, push it onto the stack;
- when you encounter an operator, pop two values from the stack (
bthena), computea op b, and push the result back onto the stack.
At the end, exactly one value remains on the stack: the result.
Do not use STL containers.