Rank of a word:
To get the rank of a word in the alphabetical list of all permutations of the word, start by alphabetically arranging the $$n$$ letters. If there are $$x$$ letters higher than the first letter of the word, then there are at least $$x*(n-1)!$$ Words above our word. After removing the first affixed letter from the set, if there are $$y$$ letters above the second letter, then there are $$y*(n-2)!$$ words more before your word, and so on. So rank of word = $$x*(n-1)! + y*(n-2)! + \dots +1$$