$\sa{aababa}\approx \sa{aba}$ since $(\sa{aa})\sa{baba}\approx (\sa{abab})\sa{a} \approx \sa{aba}$.
$\sa{a}^{10}\approx \sa{a}^{111}$
A nontrivial example is $\sa{bacbcabc} \approx \sa{bacabc}$.
$\Psi(\sa{ababbbcbcbc})\;=\; (\sa{ababbb},\, \sa{c},\, \sa{a},\, \sa{bbbcbcbc})$.
$\sa{bacbcabc} \approx \sa{bacabc}$ since $\Psi(\sa{bacbcabc})=(\sa{ba},\,\sa{c},\,\sa{a},\,\sa{bc})=\Psi(\sa{bacabc})$.
Problem 131: Idempotent equivalence |
We consider a relation between words of $A^*$, for a finite alphabet $A$, that identifies a square $uu$ to its root $u$. More precisely, any factor $u$ occurring in a word $x\in A^*$ can be replaced by $uu$, and any occurrence of $uu$ replaced by $u$. Such replacements define an equivalence relation $\approx$ between words of $A^*$.
For a given alphabet the number of equivalence classes is finite, but grows considerably fast. For alphabet sizes 1,2,3,4,5 the number of equivalence classes are respectively 1,2,7,160,332381.
The goal of the problem is to design an efficient algorithm for testing the $\approx$-equivalence of two words. To do so, with each $x\in A^*$ is associated a (characteristic) quadruple $\Psi(x)=(p,a,b,q)$, where $a,b\in A$, $pa$ is a shortest prefix and $bq$ is a shortest suffix of $x$ for which $\alph(pa)=\alph(bq)=\alph(x)$ (Recall that $\alph(u)$ is the set of letters occurring in $u$).
The sought algorithm is based on the following result (see References).