Evaluate an arithmetic expression given in Reverse Polish (postfix) notation. Valid operators are +, -, *, /. Division truncates toward zero. The expression is always valid and no division by zero occurs.
Input: one line of space-separated tokens. Output: the value of the expression.
2 1 + 3 *
9
(2 + 1) × 3.
4 13 5 / +
6
4 + (13 / 5) = 4 + 2.
10 6 9 3 + -11 * / * 17 + 5 +
22
Run your code against the sample tests, or Submit to run the full suite.