Given a string of 2 letters ab, your task is to convert it into ba.
You are allowed to add either aa or bb on either side of a current string or into the string, like ab=>abaa=>abbb=>aaabbb=>aaabaabb.
You are also allowed to erase either aa or bb any place like aaabbb=>abbb.
Is it possible? If so, how?
No, it is not possible. Here is a "parity"-type argument.
Let all of the a's equal zero and all of the b's equal one. Calculate the "parity" as the sum of all the odd digits minus the sum of all the even digits.
Then ab = -1 and ba = 1.
But adding or erasing aa or bb does not change the "parity". Therefore, the desired transformation is impossible.