#K9511. Arithmetic Expression Evaluation
Arithmetic Expression Evaluation
Arithmetic Expression Evaluation
This problem requires you to evaluate a given arithmetic expression provided as a string. The expression may contain integers (possibly with multiple digits) and the operators \(+, -, \times, \div\). The operator precedence follows the standard rules, and the division operator performs integer division truncating toward zero.
For example:
- Input:
3+2*2
produces output:7
- Input:
14/3*2
produces output:8
Your task is to implement an efficient solution that handles all these operations correctly. You should read the expression from standard input and print the result to standard output.
inputFormat
The input consists of a single line containing the arithmetic expression. The expression is a string containing digits and the operators +
, -
, *
(multiplication), and /
(integer division). There are no spaces in the expression.
outputFormat
Output the result of the expression evaluation as an integer. The output should be printed to the standard output.
## sample3+2*2
7