#C13911. Expression Evaluator
Expression Evaluator
Expression Evaluator
You are given a string representing a mathematical expression containing integers or decimal numbers, the operators \(+, -, *, /\), and parentheses. Your task is to evaluate the expression following the standard operator precedence rules. Note that the expression might result in either an integer or a floating point number.
If the expression is invalid (for example, unfinished or syntactically incorrect), output Invalid mathematical expression
.
inputFormat
The input consists of a single line containing the mathematical expression. The expression may contain spaces.
outputFormat
Output a single line displaying the result of the evaluated expression. If the expression is invalid, output Invalid mathematical expression
.
3 + 5
8