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.
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’.
For each line of the input, print a line with the result of its evaluation.
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.
Input
42. --9. +9876. --+---23. 2+3. 2-4-3. ++1-20--3-+-++-+50.
Output
42 9 9876 -23 5 -5 -66