#K5706. Evaluate Arithmetic Expression
Evaluate Arithmetic Expression
Evaluate Arithmetic Expression
You are given a string expression
that represents a valid arithmetic expression. The expression contains non-negative integers and the operators +
, -
, *
, and /
. The expression must be evaluated based on the standard operator precedence and associativity rules.
Note: Division is performed as integer division, i.e. the result is truncated toward zero. For example, \(10/3=3\) and \(10/-3=-3\).
Your task is to compute and output the integer result of the given expression.
inputFormat
The input consists of a single line containing the arithmetic expression as a string. There are no spaces in the expression.
Example:
2+3*4
outputFormat
Output a single integer which is the result of evaluating the expression.
Example Output:
14## sample
2+3*4
14