We present an algorithm that uses finite automata to find the common motifs with gaps occurring in all strings belonging to
a finite set S = {S
1,S
2,...,S
r
}. In order to find these common motifs we must first identify the factors that exist in each string. Therefore the algorithm
begins by constructing a factor automaton for each string S
i
. To find the common factors of all the strings, the algorithm needs to gather all the factors from the strings together in
one data structure and this is achieved by computing an automaton that accepts the union of the above-mentioned automata.
Using this automaton we are able to create a new factor alphabet. Based on this factor alphabet a finite automaton is created
for each string S
i
that accepts sequences of all non overlapping factors residing in each string. The intersection of the latter automata produces
the finite automaton which accepts all the common subsequences with gaps over the factor alphabet that are present in all
the strings of the set S = {S
1,S
2,...,S
r
}. These common subsequences are the common motifs of the strings.
This research has been partially supported by the Ministry of Education, Youth and Sports under research program MSM 6840770014
and the Czech Science Foundation as project No. 201/06/1039.