SP11326 ARTHEVAL - Arithmetic Evaluation

Description

Evaluate a parenthesized expression of single-digit positive integers and the binary operators +, -, \*. The order of operations differs from the canonical one in that operations have no precedence; they are simply evaluated from left-to-right, with only parentheses affecting the order of evaluation. Every intermediate step is guaranteed to have absolute value no greater than 1,000,000,000. **Input:** Input is an arithmetic expression of single-digit positive integers, the binary operators +,-, \* and parentheses (). The arithmetic expression will be well-formed and will have no spaces. **Output:** The evaluated value of the arithmetic expression. **Example Input 1:** **Example Input 2:** **Example Input 3:** ``` 1*2+1 ``` ``` 1+1*2 ``` ``` (5*6)-(40+(1)) ``` **Example Output 1:** **Example Output 2:** **Example Output 3:** ``` 3 ``` ``` 4 ``` ``` -11 ```

Input Format

N/A

Output Format

N/A