Update main.java

Parenthesis are now following order of operations. Parenthesis will now only get deleted as pairs, instead of (previously) the last "(" getting deleted and the first ")" getting deleted.