Thoughtworks interview question

Coding ques- write a program to find if a arithmetic expression is valid or not.