#C14320. Evaluate Mathematical Expression
Evaluate Mathematical Expression
Evaluate Mathematical Expression
You are given a string representing a mathematical expression. The expression consists of single-digit non-negative integers and three binary operators: +
(addition), -
(subtraction), and *
(multiplication). The multiplication operator has higher precedence than addition and subtraction (i.e., $$ '' > '+' \text{ and } '-' $$). Note that the expression does not contain any parentheses. Your task is to evaluate the expression and print the result.
For example, given the expression 3+5
2</code>, multiplication is performed first resulting in 3+(5*2)=13
.
inputFormat
A single line containing the mathematical expression as a string. For example: 3+5*2
.
outputFormat
Output a single integer which is the result of evaluating the expression. For example, for the input 3+5*2
, the correct output is 13
.## sample
3+5*2
13
</p>