Evaluate Arithmetic Expressions

Statement

Given an arithmetic expression as a string, evaluate its result. For simplicity, let’s assume that there are no parentheses in the expression and only the following binary operations are allowed: (+  \space -  \space *  \space /).

Examples

Here are a few examples of expressions and their results:

2+3=52+3=5

6+4/22=106+4/2*2=10

3+2.45/8=3.306253+2.45/8=3.30625

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.