#C14800. Evaluate Mathematical Expression
Evaluate Mathematical Expression
Evaluate Mathematical Expression
Given a mathematical expression containing non-negative integers, the operators +
, -
, *
, and /
, and parentheses, evaluate the expression and return its integer result. The expression follows standard operator precedence \(PEMDAS\) (Parentheses, Exponents, Multiplication, Division, Addition, and Subtraction). Note that division is performed as integer division (i.e. the result is rounded down).
inputFormat
The input consists of a single line containing a valid mathematical expression. The expression may include spaces, digits, the operators +
, -
, *
, /
, and parentheses.
outputFormat
Output a single integer representing the result of the evaluated expression.
## sample2 + 3
5