<doocs>0388.Longest Absolute File Path_1.py
def lengthLongestPath( input: str) -> int:
    i, n = 0, len(input)
    ans = 0
    stk = []
    while i < n:
        ident = 0
        while input[i] == '\t':
            ident += 1
            i += 1
    
        cur, isFile = 0, False
        while i < n and input[i] != '\n':
            cur += 1
            if input[i] == '.':
                isFile = True
            i += 1
        i += 1
    
        while len(stk) > 0 and len(stk) > ident:
            stk.pop()
    
        if len(stk) > 0:
            cur += stk[-1] + 1
    
        if not isFile:
            stk.append(cur)
            continue
    
        ans = max(ans, cur)
    
    return ans
def sample_funcname ( var_0 : str ) -> int :
    var_4 , var_6 = 0 , len ( var_0 )
    var_7 = 0
    var_8 = [ ]
    while var_4 < var_6 :
        var_9 = 0
        while var_0 [ var_4 ] == '\t' :
            var_9 += 1
            var_4 += 1
        var_12 , var_14 = 0 , False
        while var_4 < var_6 and var_0 [ var_4 ] != '\n' :
            var_12 += 1
            if var_0 [ var_4 ] == '.' :
                var_14 = True
            var_4 += 1
        var_4 += 1
        while len ( var_8 ) > 0 and len ( var_8 ) > var_9 :
            var_8.pop ( )
        if len ( var_8 ) > 0 :
            var_12 += var_8 [ - 1 ] + 1
        if not var_14 :
            var_8.append ( var_12 )
            continue
        var_7 = max ( var_7 , var_12 )
    return var_7
