#C6328. Arithmetic Expression Evaluator
Arithmetic Expression Evaluator
Arithmetic Expression Evaluator
You are given an arithmetic expression in the form of a string. The expression consists of non-negative integers, and the operators +
, -
, *
, /
as well as parentheses ( )
. Your task is to evaluate the expression and output the result as an integer.
The operations should follow standard operator precedence and associativity. Note that the integer division should truncate toward zero. For example, \(10/3\) evaluates to 3.
inputFormat
The input consists of a single line containing a valid arithmetic expression. The expression may include spaces.
outputFormat
Output a single integer representing the result of evaluating the arithmetic expression.
## sample3 + 2
5