P0008. Sums and substractions

Your task is to write a program that evaluates a sequence of
expressions. Each expression consists of sums, subtractions, changes of
sign and redundant symbols ‘+’ among one or more natural numbers.

Input

The input is a sequence of lines. Each line contains a correct
expression, consisting of sums, subtractions, changes of sign and
redundant symbols ‘+’ among one or more natural numbers. Each line
contains, at least, one number. The first number of each line can be
preceded by one or more changes of sign and redundant symbols ‘+ ’. Each
line ends with a dot and contains exclusively the characters ‘+’, ‘-’,
‘0’, …, ‘9’.

Output

For each line of the input, print a line with the result of its
evaluation.

Observations

- Read the input character by character, even the characters that form
  the numbers.

- The final results as well as the intermediate calculations will always
  fit in a int.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:30:31.314Z

© Jutge.org, 2006–2026.
https://jutge.org
