Evaluation of arithmetic expressions
Problem
A postfix notation is a notation of an algebraic expression in which the operands are written first, and then – operation sign. For example, the expression
a + b * c
postfix notation will be
a b c * +
.
Your task is to calculate the value of an algebraic expression written in postfix form.
Input
The input is a character string. The
/
sign in the record means integer division.
Imprint
Display the result of the expression.
Examples
# |
Input |
Output |
1 |
5 3 + 7 4 - * |
24 |