<qiyuangong>032_Longest_Valid_Parentheses_2.py
def longestValidParentheses( s):
    ls = len(s)
    stack = []
    data = [0] * ls
    for i in range(ls):
        curr = s[i]
        if curr == '(':
            stack.append(i)
        else:
            if len(stack) > 0:
                data[i] = 1
                data[stack.pop(-1)] = 1
    tep, res = 0, 0
    for t in data:
        if t == 1:
            tep += 1
        else:
            res = max(tep, res)
            tep = 0
    return max(tep, res)
def sample_funcname ( var_0 ) :
    var_2 = len ( var_0 )
    var_3 = [ ]
    var_5 = [ 0 ] * var_2
    for var_7 in range ( var_2 ) :
        var_8 = var_0 [ var_7 ]
        if var_8 == '(' :
            var_3.append ( var_7 )
        else :
            if len ( var_3 ) > 0 :
                var_5 [ var_7 ] = 1
                var_5 [ var_3.pop ( - 1 ) ] = 1
    var_13 , var_14 = 0 , 0
    for var_15 in var_5 :
        if var_15 == 1 :
            var_13 += 1
        else :
            var_14 = max ( var_13 , var_14 )
            var_13 = 0
    return max ( var_13 , var_14 )
