#C10104. Evaluate Mathematical Expression
Evaluate Mathematical Expression
Evaluate Mathematical Expression
You are given a mathematical expression as a string. The expression includes integer numbers and the operators +
and -
. The expression may include spaces that should be ignored. Your task is to compute and output the result of the expression.
The expression can contain both positive and negative integers and multiple operations. For example, the expression 5+16-3
should evaluate to 18
.
Note: The input will be provided via standard input and the output should be produced to standard output.
inputFormat
The input consists of a single line containing a mathematical expression. The expression may include spaces, digits, and the operators '+' and '-'.
For example:
5+16-3
outputFormat
Output a single integer which is the evaluated result of the mathematical expression.
For example, the output for the above input should be:
18## sample
5+16-3
18