You are given a string s that holds a maths expression with whole numbers, the signs +, -, * and /, and some spaces. Work out its value and return it.
Follow the usual order: * and / are done before + and -. Signs of the same level go from left to right. Division of whole numbers cuts off the part after the decimal point (it rounds towards zero).
The expression is always correct. Every step of the calculation stays between -2^31 and 2^31 - 1.
Do not use any built-in function that evaluates a string as maths, such as eval().
Examples
Example 1:
Input: s = "14-3*2"
Output: 8
Explanation: Multiply first: 3*2 = 6. Then 14-6 = 8.
Example 2:
Input: s = " 100/7+2 "
Output: 16
Explanation: 100/7 is 14 after cutting the decimals. Then 14+2 = 16.
Example 3:
Input: s = "10/4*4"
Output: 8
Explanation: Go from left to right: 10/4 = 2, and then 2*4 = 8.