Given some pairs of corresponding open and close parenthesis, we can
use them to build an infinite number of correct parenthesizations. For
instance, with the pairs ( ) and
[ ], all correct parenthesizations are defined
by the grammar
Can you generate all correct parenthesizations of a given size?
Input consists of a non-empty string and a strictly positive even number . The string has even size, and includes the corresponding pairs of open and close parenthesis: with , with , etc.
Print all correct parenthesizations of size that can be made up with the corresponding open and close parenthesis included in .
You can print the parenthesizations in any order.
Author: Salvador Roura
Generation: 2026-01-25T11:26:13.745Z
© Jutge.org, 2006–2026.
https://jutge.org