comefrom: <doocs>0763.Partition Labels_1.py
code: 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
masked: def sample_funcname ( var_0 : str ) -> List [ int ] :
      var_1 = [ 0 ] * 26
      for var_2 , var_3 in enumerate ( var_0 ) :
          var_1 [ ord ( var_3 ) - ord ( 'a' ) ] = var_2
      var_4 = [ ]
      var_6 = var_5 = 0
      for var_2 , var_3 in enumerate ( var_0 ) :
          var_5 = max ( var_5 , var_1 [ ord ( var_3 ) - ord ( 'a' ) ] )
          if var_2 == var_5 :
              var_4.append ( var_5 - var_6 + 1 )
              var_6 = var_5 + 1
      return var_4
  