I am trying to write a program that will write out all of the permutations of some letters. Say I want two letters and two of each letter: AABB. I want to get the 6 different ways to write those (AABB, ABAB, ABBA, BAAB, BABA, BBAA).
My first thoughts were to write a nested for loop with a for loop for each place a letter goes. But this wouldn't scale very well, as I want the program to be able to work for different numbers of letters.
I had some other ideas, but none have gone very far yet. Any suggestions?
Please don't post the same question multiple times. Stick with a one and if you want to move the thread into a different location please ask from one of our moderators in JavaForums.
I have to close this thread. Stick with the other one where I have post a solution to work around.