I found a link online that shows an algorithm to generate all combinations of a string: http://www.mytechinterviews.com/combinations-of-a-string
Algorithm is copied belo
The call of outstr.deleteCharAt counters the effect of outstr.append by deleting the last character of the outstr.
outstr.deleteCharAt
outstr.append
outstr
Each loop iteration proceeds as follows:
i+1