Reverse Polish notation
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Reverse Polish notation (RPN) is a mathematical notation in which every operator follows all of its operands. It is also known as postfix notation and does not need any parentheses as long as each operator has a fixed number of operands.
For example:
the expression in RPN is represented like
the expression in RPN is represented like
the expression in RPN is represented like
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are . Operator is an integer division . Each operand may be an integer or another expression.
Input
One line contains expression written in Reverse Polish notation. The length of expression is no more than symbols.
Output
Print the value of expression given in Reverse Polish notation.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 4K
Acceptance rate 44%