all = []

def frec(word, values=[]):
    global all
if word == '':
    all += [values]
return true
match = False
for s in subsets:
    if word.startswith(s):
        match = True
frec(word[len(s):], values + [s])
if not match:
    return frec(word[1:], values + [word[0]])
frec(word)
Solving jumbled word puzzles with python?