<qiyuangong>443_String_Compression_1.py
def compress( chars):
    anchor = write = 0
    for read, c in enumerate(chars):
        if read + 1 == len(chars) or chars[read + 1] != c:
            chars[write] = chars[anchor]
            write += 1
            if read > anchor:
                for digit in str(read - anchor + 1):
                    chars[write] = digit
                    write += 1
            anchor = read + 1
    return write
def sample_funcname ( var_0 ) :
    var_3 = var_1 = 0
    for var_5 , var_6 in enumerate ( var_0 ) :
        if var_5 + 1 == len ( var_0 ) or var_0 [ var_5 + 1 ] != var_6 :
            var_0 [ var_1 ] = var_0 [ var_3 ]
            var_1 += 1
            if var_5 > var_3 :
                for var_10 in str ( var_5 - var_3 + 1 ) :
                    var_0 [ var_1 ] = var_10
                    var_1 += 1
            var_3 = var_5 + 1
    return var_1
