<qiyuangong>139_Word_Break_1.py
def wordBreak( s, wordDict):
    queue = [0]
    ls = len(s)
    lenList = [l for l in set(map(len, wordDict))]
    visited = [0 for _ in range(0, ls + 1)]
    while queue:
        start = queue.pop(0)
        for l in lenList:
            if s[start:start + l] in wordDict:
                if start + l == ls:
                    return True
                if visited[start + l] == 0:
                    queue.append(start + l)
                    visited[start + l] = 1
    return False
def sample_funcname ( var_0 , var_1 ) :
    var_3 = [ 0 ]
    var_5 = len ( var_0 )
    var_9 = [ var_6 for var_6 in set ( map ( len , var_1 ) ) ]
    var_13 = [ 0 for var_10 in range ( 0 , var_5 + 1 ) ]
    while var_3 :
        var_15 = var_3.pop ( 0 )
        for var_6 in var_9 :
            if var_0 [ var_15 : var_15 + var_6 ] in var_1 :
                if var_15 + var_6 == var_5 :
                    return True
                if var_13 [ var_15 + var_6 ] == 0 :
                    var_3.append ( var_15 + var_6 )
                    var_13 [ var_15 + var_6 ] = 1
    return False
