#K49487. Expression Evaluator

    ID: 28653 Type: Default 1000ms 256MiB

Expression Evaluator

Expression Evaluator

You are given a string representing a basic arithmetic expression. The expression contains positive real numbers and operators: addition (+), subtraction (-), multiplication (\(\times\)), division (\(\div\)), and parentheses for grouping. Your task is to evaluate the expression following the standard order of operations. In mathematical terms, for an expression \(E\), compute its value such that:

[ E = \text{expression containing numbers, } +, -, \times, \div \text{ and } ( ) ]

If a division by zero occurs, the program must output an error message.

inputFormat

The input consists of a single line containing the arithmetic expression as a string. The expression can include spaces.

outputFormat

Output the evaluated result as a floating-point number to standard output (stdout). If the expression is invalid or contains a division by zero, output the corresponding error message.

## sample
3 + 5 * 2
13.0