-->
当前位置:首页 > 题库

PROGRAMMING:Find the value of prefix expression

Luz5年前 (2021-05-10)题库411
Arithmetic expression has prefix representation, infix representation and suffix representation. Prefix expression means that binary operators precede two operands. For example, the prefix expression of '2 + 3 * (7-4) + 8 / 4' is' + + 2 * 3 - 7 4 / 8 4 '. Please design a program to calculate the result value of the prefix expression.
###Input format:
Input a prefix expression with no more than 30 characters in one line, which only contains' + ',' - ',' * ',' / ', and operands. Different objects (operands and symbols) are separated by spaces.
###Output format:
Output the operation result of prefix expression, with 1 decimal place reserved, or the error message 'error'.
###Input example:
```in
+ + 2 * 3 - 7 4 / 8 4
```
###Output example:
```out
thirteen
```






answer:If there is no answer, please comment