// output of ./demo/bits/parenword-demo.cc: // Description: //% Binary words that are "parentheses words". //% Cf. OEIS sequence A036991. arg 1: 5 == n [Scan words 0 ... 2^n-1] default=5 arg 2: 0 == pwo [Whether to print only parentheses words] default=0 arg 3: 0 == pwo [Whether to scan words in Gray code order] default=0 ..... P ....1 P () ...1. ...11 P (()) ..1.. ..1.1 P ()() ..11. ..111 P ((())) .1... .1..1 .1.1. .1.11 P (()()) .11.. .11.1 P ()(()) .111. .1111 P (((()))) 1.... 1...1 1..1. 1..11 P (())() 1.1.. 1.1.1 P ()()() 1.11. 1.111 P ((()())) 11... 11..1 11.1. 11.11 P (()(())) 111.. 111.1 P ()((())) 1111. 11111 P ((((())))) pct=14