#C11054. Arithmetic Expression Evaluation

    ID: 40328 Type: Default 1000ms 256MiB

Arithmetic Expression Evaluation

Arithmetic Expression Evaluation

Given a string representing an arithmetic expression, evaluate it and print the result as an integer. The expression is composed of non-negative integers and the operators +, -, *, and /. Operator precedence must be strictly followed, and division should truncate toward zero.

In mathematical terms, if you have two integers \(a\) and \(b\) with an operator \(op\), the evaluation is done as:

\[ a\, op\, b \]

For example:

  • Input: "3+5 / 2" produces the result \(5\).
  • Input: "10 - 4 * 2 + 1" produces the result \(3\).

Your task is to write a program that reads an arithmetic expression from stdin and outputs its evaluated result to stdout.

inputFormat

The input consists of a single line containing the arithmetic expression. The expression may include spaces.

outputFormat

Output a single integer which is the result of evaluating the given arithmetic expression.

## sample
3+5 / 2
5

</p>