Brace Expansion

Given a string S like "a{d,c,b}f", expand it to ["adcf", "acf", "abf"]. Only simple braces without nesting.

Examples
Input: "{a,b}c{d,e}f"
Output: ["acdf","acef","bcdf","bcef"]
Hints

Brace Expansion

Given a string S like "a{d,c,b}f", expand it to ["adcf", "acf", "abf"]. Only simple braces without nesting.