def r n,s='' n[/(.)(([^[(]*)[])])?\??/]?(l=$' r l,s if$&['?'] ($3||$1).split('|'*$1[0][5]).map{|j|r l,s+j}):puts(s)end r *$<