def permutate(s): if not s: return [s] r = [] for i in range(len(s)): for m in permutate(s[:i] + s[i+1:]): r.append(s[i:i+1] + m) return r
def permutate(s): if not s: return [s] r = [] for i in range(len(s)): for m in permutate(s[:i] + s[i+1:]): r.append(s[i:i+1] + m) return r