StackMathStringParsing
Evaluate an arithmetic expression made of non-negative integers, the operators + and -, parentheses, and spaces. A minus sign may also act as a unary operator, as in -(2 + 3) or (-4). You may not use a built-in expression evaluator.
Input
A single line containing the expression.
Output
Print the value of the expression.
Constraints
1 <= length <= 10^4 The expression is valid. Operators are never written back to back (like 2+-3), but a - may appear right after ( or at the start.
Example 1
Input
1 + 1
Output
2
Simple addition.
Example 2
Input
(1+(4+5+2)-3)+(6+8)
Output
23
(1 + 11 - 3) + 14 = 23.