The third solution mirrors the string using additional symbols. The arrow symbols are used to marked previously written symbols (right-arrows for zeros and left-arrows for ones). The algorithm swaps symbols pair-wise as follows:


Swapping of two symbols

After the swapping is done, the arrow symbols have to be replaced by zeros and ones.