generate parentheses better solution