Implement generating valid parenthesis for new online judge.