S&P Global interview question

How to parse a mathematical expression.