#K9191. Taco Expression Evaluator
Taco Expression Evaluator
Taco Expression Evaluator
Given a mathematical expression as a string composed of non-negative integers, binary operators (+
, -
, *
, /
), and parentheses (
and )
, evaluate the expression following the standard operator precedence.
The division operator /
uses integer division. In other words, if a and b are two non-negative integers, the expression
For example, the expression 3+5*2 evaluates to 13.
You are expected to implement a solution using the algorithm based on stacks, which processes the operators and operands properly and respects the precedence and associativity rules.
inputFormat
The input consists of a single line containing a valid mathematical expression.
outputFormat
Output a single integer, the result of evaluating the expression.
## sample3+5*2
13
</p>