#C12181. Evaluate Mathematical Expression
Evaluate Mathematical Expression
Evaluate Mathematical Expression
Given a mathematical expression as a string, compute its integer result. The expression contains non-negative integers and the binary operators +
and -
. Whitespace can appear anywhere in the expression and should be ignored during evaluation. The expression is guaranteed to be valid and may include multi-digit numbers.
For example, the expression 3 + 4 - 2
evaluates to 5
, and 100 - 50 + 25
evaluates to 75
.
inputFormat
The input consists of a single line containing the mathematical expression. The expression may include spaces.
outputFormat
Output a single integer which is the result of evaluating the expression.
## sample3 + 4 - 2
5