You must evaluate a string written in Reverse Polish notation and output the result.
The program must accept an input and return the output. For programming languages that do not have functions to receive input/output, you can assume functions like readLine/print.
You are not allowed to use any kind of "eval" in the program.
Numbers and operators are separated by one or more spaces.
You must support at least the +, -, * and / operators.
You need to add support to negative numbers (for example,
-4 is not the same thing as
0 4 -) and floating point numbers.
You can assume the input is valid and follows the rules above
-4 5 +
5 2 /
5 2.5 /
5 1 2 + 4 * 3 - +
4 2 5 * + 1 3 2 * + /