$\sa{a}^{10}\approx \sa{a}^{111}$ and $\sa{aababa}\approx \sa{aba}$ since $\sa{aa}\approx \sa{a}\ \land\ \sa{baba}\approx \sa{ba}$ as well as $\sa{aba}\approx \sa{ababaa}$.
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{bac},\,\sa{b},\,\sa{c},\,\sa{abc})$ and $\Psi(\sa{bacabc})=\Psi(\sa{bacbcabc})$.
Assume we have a finite alphabet $\Sigma$ and there is an idempotent equivalence $xx\approx x$ between any two words in $\Sigma^+$. This equivalence means that any word or any factor $x$ can be replaced by $xx$ and $xx$ can be replaced by $x$. Such replacements imply an equivalence relation $\approx$ between words.
For a given alphabet the number of equivalence classes is finite, but grows considerably. For alphabets of sizes 1,2,3,4,5 the number of equivalence classes is respectively 1,2,7,160,332381.
Let $alpha(u)$ be the set of all letters appearing in $u$. With each $u\in A^*$ we associate a (characteristic) quadruple $\Psi(u)=(p,a,b,q)$, where $a,b\in \Sigma$, $pa$ is a shortest prefix and $bq$ is a shortest suffix of $u$ such that $alpha(pa)=alpha(bq)=alpha(u)$.
We refer to the classical book of Lothaire for a proof of the following fact. We must assume here it is valid.
We assume that the above lemma is valid and we are interested in an efficient algorithmic implentation of the lemma.