#C14769. Basic Calculator Simulation
Basic Calculator Simulation
Basic Calculator Simulation
You are given a mathematical expression as a string expr that consists of non-negative integers and the operators +
, -
, *
, and /
. Your task is to evaluate the expression by following the standard order of operations. In this context, the multiplication and division operators have higher precedence than addition and subtraction. Formally, the precedence rules are given as:
$$\times,\ \div$$ have higher precedence than $$+,\ -$$.
Note that the division operator /
performs integer division. For example, 9/3
evaluates to 3.
It is guaranteed that the expression is valid and contains no spaces.
inputFormat
The input consists of a single line containing the mathematical expression.
Example: 2+3*4-5
outputFormat
Output a single integer which is the result of evaluating the expression.
## sample2+3
5
</p>