I am trying to write a code in Java that would allow me to take a random String like "cat" and generate all the possible letter combinations, including shorter strings.
The answers offered on the other question marked as the duplicate (Generating all permutations of a given string) don't answer this question. None of the answers include the smaller words.
For Example: c, ca, ct, cat, cta, a, ac, at, act, atc, t, ta, tc, tac, tca. ( I think that's all of them)
I have seen several answers throughout SO, but all the ones I have found reuse letters. Like ccc, cca, cct, cac, caa, cat
This answer seems to be the closest All possible words, but it allows letters to be reused. I was thinking maybe I could just modify that code to do a check of whether the character was already used, but that becomes tough with words with repeated letters, i.e. cattail.
Any and all help would be appreciated. I'll post any code if it'll help, but the link above is pretty much as far as I've gotten.
Thanks