<doocs>0763.Partition Labels_1.py
def partitionLabels( s: str) -> List[int]:
    last = [0] * 26
    for i, c in enumerate(s):
        last[ord(c) - ord('a')] = i
    ans = []
    left = right = 0
    for i, c in enumerate(s):
        right = max(right, last[ord(c) - ord('a')])
        if i == right:
            ans.append(right - left + 1)
            left = right + 1
    return ans
def sample_funcname ( var_0 : str ) -> List [ int ] :
    var_6 = [ 0 ] * 26
    for var_8 , var_9 in enumerate ( var_0 ) :
        var_6 [ ord ( var_9 ) - ord ( 'a' ) ] = var_8
    var_12 = [ ]
    var_14 = var_13 = 0
    for var_8 , var_9 in enumerate ( var_0 ) :
        var_13 = max ( var_13 , var_6 [ ord ( var_9 ) - ord ( 'a' ) ] )
        if var_8 == var_13 :
            var_12.append ( var_13 - var_14 + 1 )
            var_14 = var_13 + 1
    return var_12
