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