Well suppose I got a String "ABC", I need to put up all possible combinations.

Eg. AAA, AAB, AAC, ABA, ABB.....etc

I need a non-recursive technique, and the code should work for Strings of length less than 30.

Anybody with a solution?