Implement the regular expression matching again for the new online judge.