#C4216. Simple Math Expression Evaluator
Simple Math Expression Evaluator
Simple Math Expression Evaluator
Given a mathematical expression consisting of non-negative integers and the operators +
and -
, calculate its result. The expression is provided as a single string without any spaces.
Specifically, the arithmetic expression is of the form:
\(n_1 \pm n_2 \pm n_3 \pm \cdots \pm n_k\)
Process the expression from left to right to compute the answer.
inputFormat
The input consists of a single line which is a string representing the arithmetic expression (only digits with '+' and '-' operators).
outputFormat
Output a single integer which is the result of evaluating the expression.
## sample3+2
5