You are given a string s that holds a maths expression. It can have digits, the signs + and -, round brackets ( and ), and spaces. Work out its value and return it.
Do not use any built-in function that evaluates a string as maths, such as eval().
A - sign can also come first, in front of a number or a bracket, to turn it negative.
Examples
Example 1:
Input: s = "7 - (2 + 3)"
Output: 2
Explanation: The bracket is 5, and 7 - 5 = 2.
Example 2:
Input: s = "10-(4-(2+1))"
Output: 9
Explanation: 2+1 = 3, then 4-3 = 1, then 10-1 = 9.
Example 3:
Input: s = "-(3+4)+10"
Output: 3
Explanation: The first "-" flips the bracket: -7 + 10 = 3.