The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string:
john -> ohnj, hnjo, njoh, john
You may also cycle in the other direction, moving characters from the end:
john -> njoh, hnjo, ohnj, john
You should still output one rotation per letter even if the original word is reached before that:
heehee -> eeheeh, eheehe, heehee, eeheeh, eheehe, heehee
Character arrays are allowed, as long as the result works as shown above.
Shortest answer wins!
heehee
returns to the original order in fewer cycles than its length, do we stop there? I expect this would make a big difference for many answers. \$\endgroup\$