#K55642. Evaluate Mathematical Expression
Evaluate Mathematical Expression
Evaluate Mathematical Expression
You are given a string representing a mathematical expression that contains only positive integers and the operators +, -, *, /. The operators * and / have higher precedence than + and -. All operations should be performed from left to right taking into account operator precedence. Note that division between two integers should truncate toward zero.
Your task is to compute and output the result of the expression. The expression may contain spaces.
For example, given the expression \(3+ 5 / 2\), the answer is \(3 + \lfloor5/2\rfloor = 3 + 2 = 5\).
inputFormat
The input consists of a single line containing the expression string. The string contains only digits, spaces, and the characters '+', '-', '*', and '/'.
outputFormat
Output a single integer representing the result obtained after evaluating the expression.
## sample3+ 5 / 2
5