Ok, I have scoured the internet for days and even checked these forums. I do have an idea of how the algorithm should work, I just have no idea how to implement it.
Say you have the word ABCDEF.
The way I figure to solve it is to split it into columns, per se.
|A|B|C|D|E|F|
So the first iteration would yield A, B, C, D, E, F. Now, using each of those in the first column, increment the second column.
AB
AC
AD
AE
AF
Increment the third column.
ABC
ABD
ABE
ABF
Since we have reached the last letter in the third column, back up and increment the previous column.
ACD
ACE
ACF
Notice I don't use ACB, as that is exactly the same as ABC in terms of being unique.
Since the last letter was used, increment the previous column again.
ADE
ADF <- Last letter reached, increment previous
AEF
That is all the UNIQUE three letter combinations possible. Now, step up to four letters
ABCD
ABCE
ABCF <- Last letter reached, increment previous
ABDE
ABDF <- Last letter reached, increment previous
ABEF
The third column cannot be F because that is the last letter and would only allow a three letter word, which we have done already. Back up another column.
ACDE
ACDF <- Last letter reached, increment previous
ACEF <- Last letter reached, increment previous
ADEF <- Last letter reached, increment previous
Again, the column cannot be D as it would end up a three letter word. That is all the four letter UNIQUE combinations.
ABCDE
ABCDF <- Last letter reached, increment previous
ABCEF <- Last letter reached, increment previous
ABDEF
That is all the five letter combinations. And then, of course, the only 6 letter combination, ABCDEF.
Now, here comes the fun part. Notice how all the above combination start with the first letter. To get a whole list starting with the second letter, hack off the first.
Example: ABCDE -> BCDE -> CDE -> DE -> D
Now that I have shown the method, I need help with the implementation.
Note that the word may have more than one of the same letter (e.g AABCDE) so I would need to keep track of the letter that I am on.
Say I just finished ABF and am heading to ACD. I need to know that I am changing the second column from the second letter to the third letter. That means that the third column cannot be any letter less than the fourth letter.
Thanks for helping.

