s is an arithmetic expression with non-negative whole numbers, the operators +, -, *, / and optional spaces. There are no brackets. Multiplication and division come before addition and subtraction; division of whole numbers truncates toward zero. Return the value.
For "3+2*2" the answer is 7; for " 3/2 " it is 1.
Example 1
Input:
calculate('3+2*2')
Output:
7
Example 2
Input:
calculate(' 3/2 ')
Output:
1
1 <= len(s) <= 100000No results yet
Run your code to check it against the examples, or submit to run every test.