Basic Calculator Iii

hard
1. Implement a basic calculator to evaluate a simple expression string.
2. String will contain only non-negative integers, '+', '-', '*', '/' operators, and open '(' and closing parentheses ')'. 
3. All intermediate results will be in the range of [-2^31, 2^31 - 1].

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1. 1 <= s.length <= 10^4
2. s consists of digits, '+', '-', '*', '/', '(', and ')'.
3. s is a valid expression.

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
2*(5+5*2)/3+(6/2+8)
Output
21
Previous
Basic Calculator Ii
Next
Lexicographically Smallest Subsequence

Related Questions