s is an expression with whole numbers, +, -, round brackets and optional spaces. - can also be a minus sign in front of a bracket or a number ("-(2+3)", "1-(-2)"). Return the value.
For "(1+(4+5+2)-3)+(6+8)" the answer is 23.
Example 1
Input:
calculate_brackets('(1+(4+5+2)-3)+(6+8)')
Output:
23
Example 2
Input:
calculate_brackets('1 - (-2)')
Output:
3
1 <= len(s) <= 100000No results yet
Run your code to check it against the examples, or submit to run every test.