440 Combinatorics of Compositions and Words
}
printf("%d]]);\n",Au[sizeAu-1][sizeAu-1]);
fprintf(fout,"%d]]);\n",Au[sizeAu-1][sizeAu-1]);
}
/* main procedure */
void main()
{
int i;
printf("Enter the number k of letters in your alphabet: ");
scanf("%d",&NUMBERLETTER);
numberrow=1;
printf("Enter the length of the pattern (3-6): ");
scanf("%d",&lenpattern);
numbercolumn=lenpattern;
printf("Enter the pattern (space between the letters): ");
for(i=0;i<lenpattern;i++)
scanf("%d",&pattern[0][i]);
fout=fopen("data.dat","w");
printf("The automaton for the number
of %d-ary words of length n\n",NUMBERLETTER);
printf("that avoid the pattern ");
fprintf(fout,"The automaton for the number
of %d-ary words of length n\n",NUMBERLETTER);
fprintf(fout,"that avoid the pattern ");
for(i=0;i<lenpattern;i++)
{
printf("%d ",pattern[0][i]);
fprintf(fout,"%d ",pattern[0][i]);
}
printf(" is given by:\n\n");
fprintf(fout," is given by:\n\n");
printf("The states are \n");
fprintf(fout,"The states are \n");
extendbymat();
nclass=0; sizeAu=0; automat();
printautomaton();
fclose(fout);
}
We show how to use the program for the pattern 112.
Example G.2 To compute the automaton for avoidance of the subsequence
pattern 112 in 3-ary words using the program TOU
AUTO, the user inputs
the alphabet, the length of the pattern, and the pattern:
Enter the number k of letters in your alphabet: 3
Enter the length of the pattern (3-6): 3
Enter the pattern (space between the letters): 1 1 2
© 2010 by Taylor and Francis Group, LLC