#K14576. Evaluate Multiplication and Division Expression
Evaluate Multiplication and Division Expression
Evaluate Multiplication and Division Expression
Given a string representing a mathematical expression consisting solely of non-negative integers, the multiplication operator (*
), and the division operator (/
), evaluate the expression from left to right. Note that there is no operator precedence besides left-to-right evaluation. The division operation should perform floor division (i.e., rounding down to the nearest integer). For example, the expression \(8/3*4\) evaluates to 8.
inputFormat
The input is a single line string that represents a mathematical expression. The expression contains only non-negative integers and the operators '*' and '/'. There are no spaces in the expression.
outputFormat
Output a single integer which is the result of evaluating the expression from left to right using floor division for '/' operations.## sample
6*3
18