P1090 postfix expression

Title Description

The so-called postfix expression refers to an expression: where no longer referenced after two operations on objects in order to calculate all arithmetic symbols appear, from left to right strict new conduct (regardless of the operation parentheses, arithmetic symbols precedence).

Such as: 3 (5-2) corresponding to the postfix expression is +7: 3.5.2. - 7 + @. '@' Symbol for the end of the expression. '.' End symbol operand.

Input Format

Input: a string representing the postfix expression. (String length not exceeding 1000)

Output Format

Output: The value of the expression.

Sample input

3.5.2.-*7.+@

Sample Output

16

Guess you like

Origin www.cnblogs.com/problems/p/P1090.html