#K58782. Evaluate Simple Expression
Evaluate Simple Expression
Evaluate Simple Expression
You are given a string representing a simple mathematical expression. The expression consists of non-negative integers and the + and - operators.
The expression should be evaluated from left to right without operator precedence. That is, given an expression of the form $$a_1 \; op_1 \; a_2 \; op_2 \; a_3 \; \dots,$$ the operations are performed in the order they appear.
For example, the expression "10+5-27+6" is evaluated as follows:
- 10 + 5 = 15
- 15 - 27 = -12
- -12 + 6 = -6
Your task is to compute and output the final result of the expression.
inputFormat
The input consists of a single line containing a string s
, which is the arithmetic expression. The string includes digits (0-9) and the operators '+' and '-'. There are no spaces in the input.
outputFormat
Output a single integer which is the result of evaluating the expression from left to right.
## sample5
5