La seguente famiglia di problemi si presta (e' chiusa rispetto ad induzione e prevede un numero polinomiale di problemi): opt[i][j] = the number of strings s over the alphabet {'(',')'} such that: 1. s is a prefix of a well formed parenthesis formula; 2. s matches the prefix p[1,..., i] of the pattern; 3. in s the number of '(' exceeds by precisely j the number of ')'. Thus opt[n][0] is the answer to our problem.