Problem

Source: 239 MO 2021 (10-11).6

Tags: combinatorics



The alphabet of the tribe AAB consists of the only letters $A$ and $B$. However, if you insert or delete the combination $AAA$ or $BBB$ for any words, the meaning of the word will not change. In addition, if $AB$ is replaced with $BBAA$, or vice versa, the meaning of the word doesn't change. The same holds for $BA$ and $AABB$. Is it true that $AB$ and $BA$ have the same meaning?