#T329. 中缀表达式值
中缀表达式值
Description
Input an infix expression (composed of operands from 0-9, the four operators addition +, subtraction -, multiplication *, division /, and left and right parentheses. Note that - can also serve as a negative sign. The expression ends with the @ symbol). Determine whether the expression is valid. If it is not valid, output "NO"; otherwise, convert the expression to postfix form, evaluate the postfix expression, and output the result.
Note: Stack operations must be used; directly outputting the value of the expression is not allowed.
Input Format
A single line containing a string ending with @.
Output Format
If the expression is invalid, output "NO" (in uppercase).
If the expression is valid, output the computed result.
1+2\*8-9
8