#K59767. Evaluate Arithmetic Expression
Evaluate Arithmetic Expression
Evaluate Arithmetic Expression
You are given a string representing a simple arithmetic expression. The expression contains only non-negative integers and two binary operators: +
and -
. There are no parentheses in the expression.
The expression follows the format:
$$ Expression = Number \; [Operator \; Number]* $$
Your task is to evaluate the expression and output the result as an integer.
For example, the expression 3+5-2
evaluates to 6
.
inputFormat
The input consists of a single line containing the arithmetic expression.
Example: 3+5-2
outputFormat
Output a single integer: the result of evaluating the arithmetic expression.
## sample3+5
8