word break and generate parentheses