Tried to simulate the ring sorting using a double-ended queue, which worked.
However, one of the tags in the problem says "String Suffix Structures", can anyone explain the idea of using it in this problem?