Hey All,

I'm working on a "scrabble cheat program" ( :P ) and while I'm aware of the next_permutation function, what I really need is a "next_combination" function. Does anyone know if there is an opensource one somewhere(i tried googling) or one hidden in the standard library?

Basically, I want a function that has input/output like this

input: ABA

Output:
AAB
ABA
BAA
AA
AB
BA
BB
A
B

input: ABC

ABC
ACB
BCA
BAC
CBA
CAB
AB
AC
BA
CA
CB
BC
A
B
C

String will be unknown length.

I tried using recursion, but that made my head hurt pretty bad.

Please and Thankyou,

Johnny