Given a string `s` which represents an expression, evaluate this expression and return its value.
The integer division should truncate toward zero.
You may assume that the given expression is always valid. All intermediate results will be in the range of `[-2^31, 2^31 - 1]`.
Note: You are not allowed to use any built-in function which evaluates strings as mathematical expressions, such as `eval()`.
### Constraints
- `1 <= s.length <= 3 * 10^5`
- `s` consists of integers and operators (`'+'`, `'-'`, `'*'`, `'/'`) separated by some number of spaces.
- `s` represents a valid expression.
### Input Format
A single line containing the expression string `s`.
### Output Format
Print a single integer representing the evaluated result.
Sample Cases
Example 1Sample Case
Input: 3+2*2
Output: 7
Example 2Sample Case
Input: 3/2
Output: 1
Example 3Sample Case
Input: 3
Output: 3
Example 4Sample Case
Input: 3+
Output: 3
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.