def combine(s):
    out = []
length = len(s)

def loc(start):
    for i in range(start, length):
        out.append(s[i])
print(out)
if i < length - 1:
    loc(i + 1)
del out[-1]
loc(0)
Generating combinations of a string (not permutations)