notice that when we arrange the first character we repeat it till we have arranged all the other characters with it in different order of position of their occurance. we do it recursively as we can see it has to be done in phases and we have to return to the previous phase to change the character and arrange all the others including the previous character for the next set of words arranged. by the