A simple mathematical expression can be defined in the following BNF grammar.
exp = number | "(" exp op exp ")"
op = "+" | "-" | "*" | "/"
Write a method parse that checks whether a given input string follows the rule.
Define helper methods if needed. There are multiple ways of doing it. Feel free to use our helper methods as well.