<qiyuangong>087_Scramble_String_1.py
def isScramble( s1, s2):
    if s1 == s2:
        return True
    if len(s1) != len(s2):
        return False
    ls = len(s1)
    letters = [0] * 26
    for i in range(ls):
        letters[ord(s1[i]) - ord('a')] += 1
        letters[ord(s2[i]) - ord('a')] -= 1
    for i in range(26):
        if letters[i] != 0:
            return False
    dp = [[[False] * ls for i in range(ls)] for i in range(ls + 1)]
    for i in range(ls):
        for j in range(ls):
            dp[1][i][j] = (s1[i] == s2[j])
    
    for cur_len in range(2, ls + 1):
        for i in range(ls - cur_len + 1):
            for j in range(ls - cur_len + 1):
                dp[cur_len][i][j] = False
                for k in range(1, cur_len):
                    if dp[cur_len][i][j]:
                        break
                    dp[cur_len][i][j] = dp[cur_len][i][j] or (dp[k][i][j] and dp[cur_len - k][i + k][j + k])
                    dp[cur_len][i][j] = dp[cur_len][i][j] or (dp[k][i + cur_len - k][j] and dp[cur_len - k][i][j + k])
    return dp[ls][0][0]
def sample_funcname ( var_0 , var_1 ) :
    if var_0 == var_1 :
        return True
    if len ( var_0 ) != len ( var_1 ) :
        return False
    var_5 = len ( var_0 )
    var_8 = [ 0 ] * 26
    for var_10 in range ( var_5 ) :
        var_8 [ ord ( var_0 [ var_10 ] ) - ord ( 'a' ) ] += 1
        var_8 [ ord ( var_1 [ var_10 ] ) - ord ( 'a' ) ] -= 1
    for var_10 in range ( 26 ) :
        if var_8 [ var_10 ] != 0 :
            return False
    var_14 = [ [ [ False ] * var_5 for var_10 in range ( var_5 ) ] for var_10 in range ( var_5 + 1 ) ]
    for var_10 in range ( var_5 ) :
        for var_15 in range ( var_5 ) :
            var_14 [ 1 ] [ var_10 ] [ var_15 ] = ( var_0 [ var_10 ] == var_1 [ var_15 ] )
    for var_17 in range ( 2 , var_5 + 1 ) :
        for var_10 in range ( var_5 - var_17 + 1 ) :
            for var_15 in range ( var_5 - var_17 + 1 ) :
                var_14 [ var_17 ] [ var_10 ] [ var_15 ] = False
                for var_18 in range ( 1 , var_17 ) :
                    if var_14 [ var_17 ] [ var_10 ] [ var_15 ] :
                        break
                    var_14 [ var_17 ] [ var_10 ] [ var_15 ] = var_14 [ var_17 ] [ var_10 ] [ var_15 ] or ( var_14 [ var_18 ] [ var_10 ] [ var_15 ] and var_14 [ var_17 - var_18 ] [ var_10 + var_18 ] [ var_15 + var_18 ] )
                    var_14 [ var_17 ] [ var_10 ] [ var_15 ] = var_14 [ var_17 ] [ var_10 ] [ var_15 ] or ( var_14 [ var_18 ] [ var_10 + var_17 - var_18 ] [ var_15 ] and var_14 [ var_17 - var_18 ] [ var_10 ] [ var_15 + var_18 ] )
    return var_14 [ var_5 ] [ 0 ] [ 0 ]
