Solve generate parentheses