solve generate parentheses