#C11878. Evaluate Expression
Evaluate Expression
Evaluate Expression
You are given a string representing a mathematical expression containing non-negative integers along with the + and - operators. The expression may include extra spaces. Your task is to evaluate the expression and output the result. The operations should be processed in a single left-to-right pass, thus achieving a time complexity of \(O(n)\), where \(n\) is the length of the expression.
Note: No multiplication, division, or parentheses are present in the input.
inputFormat
The input consists of a single line containing the mathematical expression. The expression includes digits (0-9), spaces, and the operators + and -.
outputFormat
Print a single integer representing the result of the evaluated expression.
## sample3
3