#K2461. Evaluate Mathematical Expression with Operator Precedence
Evaluate Mathematical Expression with Operator Precedence
Evaluate Mathematical Expression with Operator Precedence
You are given a mathematical expression as a single line that contains non-negative integers and two operators: addition (+) and multiplication (*). In the expression, the multiplication operator (*) has a higher precedence than the addition operator (+). Your task is to compute and output the result after evaluating the expression accordingly.
For example, the expression 3+5*2
should be evaluated as 3+(5*2)=13
and not as (3+5)*2=16
.
The expression will always be valid and will not contain any spaces.
Note: The input is read from standard input (stdin) and the output (result) should be written to standard output (stdout).
inputFormat
The input consists of a single line containing the expression. The expression includes non-negative integers and the operators '+' and '*'. For example:
3+5*2
outputFormat
Output a single integer which is the result of the expression evaluation, taking into account the operator precedence (multiplication before addition).
## sample3+5
8