comefrom: <doocs>0443.String Compression_1.py
code: def compress( chars: List[str]) -> int:
      i, k, n = 0, 0, len(chars)
      while i < n:
          j = i + 1
          while j < n and chars[j] == chars[i]:
              j += 1
          chars[k] = chars[i]
          k += 1
          if j - i > 1:
              cnt = str(j - i)
              for c in cnt:
                  chars[k] = c
                  k += 1
          i = j
      return k
masked: def sample_funcname ( var_0 : List [ str ] ) -> int :
      var_1 , var_2 , var_3 = 0 , 0 , len ( var_0 )
      while var_1 < var_3 :
          var_4 = var_1 + 1
          while var_4 < var_3 and var_0 [ var_4 ] == var_0 [ var_1 ] :
              var_4 += 1
          var_0 [ var_2 ] = var_0 [ var_1 ]
          var_2 += 1
          if var_4 - var_1 > 1 :
              var_5 = str ( var_4 - var_1 )
              for var_6 in var_5 :
                  var_0 [ var_2 ] = var_6
                  var_2 += 1
          var_1 = var_4
      return var_2
  