temp word figure rotating word rotating the word times gives each letter chance to begin the word while the selected letter occupies this first positionall the other letters are then anagrammed (arranged in every possible positionfor catwhich has only three lettersrotating the remaining two letters simply switches them the sequence is shown in table table anagramming the word cat word display wordfirst letter remaining letters action cat yes yes no yes yes at ta at tc ct rotate at rotate ta rotate cat rotate tc rotate ct no yes yes no no tc ca ac ca at cta cat atc act atc tca tac tca cat rotate atc rotate ca rotate ac rotate tca done notice that we must rotate back to the starting point with two letters before performing three-letter rotation this leads to sequences like catctacat the redundant sequences aren' displayed how do we anagram the rightmost - lettersby calling ourselves the recursive doanagram(method takes the size of the word to be anagrammed as its only parameter this word is understood to be the rightmost letters of the complete word each