The challenge here is to take a string: "john", for example And print all possible inversions of it, until the characters are in their original order, as shown below: john ohnj hnjo njoh john Shortest answer wins! EDIT: To clarify, the first string is the input, and I'd like to see the string cycled through until the original, or input form is printed. If the string can be reached quicker than looping through the entire string, I'd still like to see the whole string gone through. Cycling in the other direction should be just fine, as long as the proper result is still reached.