#C12826. Expression Evaluator

    ID: 42296 Type: Default 1000ms 256MiB

Expression Evaluator

Expression Evaluator

You are given a string representing a simple mathematical expression. The expression contains positive or negative floating-point numbers and the operators +, -, *, and /, following standard operator precedence rules. Your task is to write a program that evaluates the expression and outputs the result as a floating-point number.

For example, given the expression 1 + 2 * 3, the correct result is 7.0 because multiplication is performed before addition. All results should be printed in a floating point format.

The mathematical expression can be formally described by the following grammar:

\( E \rightarrow T \; | \; E + T \; | \; E - T \)
\( T \rightarrow F \; | \; T * F \; | \; T / F \)
\( F \rightarrow -?\text{number} \)

inputFormat

The input is provided via standard input (stdin) as a single line containing a valid arithmetic expression. The expression will include numbers (which may be integers or decimals) and the operators '+', '-', '*', '/'. There will be no parentheses and the tokens may be separated by spaces.

outputFormat

Output the result of the evaluated expression as a floating-point number. The output should be written to standard output (stdout) without any additional characters or formatting.

## sample
3 + 5
8.0