#K35267. Parsing Mathematical Equations
Parsing Mathematical Equations
Parsing Mathematical Equations
You are given a string representing a mathematical equation that includes only non-negative integers and the operators +
(addition) and *
(multiplication). The equation does not contain any whitespace and follows the standard operator precedence rules, which means multiplication is performed before addition.
Your task is to evaluate the equation and output the result.
For example, given the equation:
2+3*4
The correct evaluation is:
2 + (3 * 4) = 14
inputFormat
The input consists of a single line containing the equation string. The string will only include digits (0-9), the character '+' representing addition, and '*' representing multiplication.
The input should be read from standard input (stdin).
outputFormat
Output a single integer result after evaluating the equation according to standard precedence rules. Write your answer to standard output (stdout).
## sample2+3*4
14