Problem 91: Palindromic Concatenation of Palindromes |
Palindromes constitute another type of regularity different from periodicity. They appear naturally in data folding when the process requires segments of data to be matched like in some genomic sequences. The problem deals with palindromes occurring in a product of palindromes.
Given a finite set of words $X$, computing the number of all palindromes in $X^2$ can be easily done in $n\cdot |X|$ time, where $n$ is the total length of words in $X$. However, there is a much simpler and more efficient method when $X$ is itself a set of palindromes.