Under the specified grammar, an expression evaluates to a set of strings:
A single lowercase letter evaluates to a set containing just that character.
The union of two or more expressions enclosed in curly braces {e_1, e_2, ...} evaluates to the union of the sets generated by
The concatenation of two expressions
Given a string expression representing a valid grammar expression, return the sorted list of all unique words generated by the expression.
Constraints:
expression.length
expression[i] consists of '{', '}', ',', or lowercase English letters.
The given expression represents a set of words based on the grammar given in the description.
Under the specified grammar, an expression evaluates to a set of strings:
A single lowercase letter evaluates to a set containing just that character.
The union of two or more expressions enclosed in curly braces {e_1, e_2, ...} evaluates to the union of the sets generated by
The concatenation of two expressions
Given a string expression representing a valid grammar expression, return the sorted list of all unique words generated by the expression.
Constraints:
expression.length
expression[i] consists of '{', '}', ',', or lowercase English letters.
The given expression represents a set of words based on the grammar given in the description.