<qiyuangong>080_Remove_Duplicates_from_Sorted_Array_II_1.py
def removeDuplicates( nums):
    if nums is None:
        return 0
    length = len(nums)
    result = 0
    i = j = 0
    while i < length:
        j = i
        while j < length:
            if nums[j] != nums[i]:
                break
            j += 1
        if j-i > 2:
            length -= j-i-2
            for k in range(j-i-2):
                del nums[i]
            result += 2
            j = i+2
        else:
            result += (j-i)
        i = j
    return result
def sample_funcname ( var_0 ) :
    if var_0 is None :
        return 0
    var_4 = len ( var_0 )
    var_5 = 0
    var_7 = var_6 = 0
    while var_7 < var_4 :
        var_6 = var_7
        while var_6 < var_4 :
            if var_0 [ var_6 ] != var_0 [ var_7 ] :
                break
            var_6 += 1
        if var_6 - var_7 > 2 :
            var_4 -= var_6 - var_7 - 2
            for var_11 in range ( var_6 - var_7 - 2 ) :
                del var_0 [ var_7 ]
            var_5 += 2
            var_6 = var_7 + 2
        else :
            var_5 += ( var_6 - var_7 )
        var_7 = var_6
    return var_5
