Implement the function evaluate(expression) that computes the integer result of a string expression. The expression uses two named operations: "add" adds together all of its arguments, while "sub" subtracts the second argument from the first. The operations may be nested arbitrarily.
The expression may contain negative integers and spaces; the input is always syntactically valid.
Example 1:
Input: "add(add(1,3), sub(1,3))"
Output: 2
Explanation: It computes (1 + 3) + (1 - 3) = 2.
Example 2:
Input: "sub(1,3)"
Output: -2
Example 3:
Input: "add(-1, 3)"
Output: 2
Constraints:
"add", "sub" functions, integer numbers, parentheses "()", commas ",", and spaces.