Problem 1096 · Hard

Brace Expansion II

Parse nested brace expressions recursively, combining comma-separated groups by union and adjacent groups by Cartesian-product concatenation, then return the distinct words in sorted order.

Open the interactive visualisation