#C4668. Arithmetic Expression Evaluation
Arithmetic Expression Evaluation
Arithmetic Expression Evaluation
Given a string representing an arithmetic expression containing only single-digit integers, the operators ( + ), ( - ), ( \times ), and ( \div ), and parentheses, evaluate the expression according to the standard order of operations.
The precedence is defined as follows: multiplication and division have higher precedence than addition and subtraction, and any expression enclosed in parentheses ( (\ ) will be evaluated first.
For example, the expression (3+2)*2
evaluates to 10 and 3/2
evaluates to 1.5.
inputFormat
A single line string that represents an arithmetic expression. The expression may include spaces.
outputFormat
The result of evaluating the arithmetic expression. If the result is an integer, print it as an integer; otherwise, print the floating-point number.## sample
3+2
5