Equal Strings

You are given a string of length $n$. You can do any of the following two operations in this string any number of times.


This is a companion discussion topic for the original entry at https://toph.co/p/equal-string