Given a string with three each of three different letters ordered thus:
A A A B B B C C C
It is possible through a series of three moves to change the order into:
A B C A B C A B C
A ‘move’ consists of taking a section of the string and reversing the order of the items within it. The brackets show the section to be reversed in the subsequent move:
A(AABB)BCCC -> ABBA(ABC)CC -> AB(BACBAC)C -> ABCABCABC
Using the exact same idea, how many moves will it take to change between the following?
A A A A A B B B B B C C C C C D D D D D E E E E E
A B C D E A B C D E A B C D E A B C D E A B C D E