← 返回 sofi 的题目列表Basic Calculator
类型:online_judge
Implement a basic calculator to evaluate a simple mathematical expression string that contains non-negative integers, +, -, *, / operations, and parentheses. Output the result of the computation. Note: Do not use the built-in eval() function.
Example:
Input: "3 + 5"
Output: 8
**Input: "(2+3)*2"
Output: 10
**Input: "( 1+(4+5+2)-3)+(6+8)"
Output: 23
Constraints:
The length of the input expression does not exceed 100.
The input string contains only valid characters.
Example
Input
3 + 5