Implement the longest valid parenthesis solution again for new online judge.