Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if S[i] != S[i+1]:
        del S[i:i+2]
        c+=2
        N-=2
        if i>=1:
            i-=2
        else:
            i-=1
    i+=1
    #print(i,N,S,f)                                                                      
    if i+1 == N or N < 2:
        break
print(c)

Fixed submission:
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)

Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if S[i] != S[i+1]:
        del S[i:i+2]
        c+=2
        N-=2
        if i>=1:
            i-=2
        else:
            i-=1
    i+=1
    #print(i,N,S,f)                                                                      
    if i+1 == N:
        break
print(c)

Fixed submission:
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)

Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if S[i] != S[i+1]:
        del S[i:i+2]
        c+=2
        N-=2
        i-=1
        f=1
    if N<2:
        break
    i+=1
    if i+1 == N:
        i=0
        if f==0:
            break
        f=0
print(c)

Fixed submission:
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)

Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)
c=0
i=0
f=0
while(1):
    if S[i] != S[i+1]:
        del S[i:i+2]
        c+=2
        N-=2
        i-=1
        f=1
    i+=1
    if i+1 == N:
        i=0
        if f==0:
            break
        f=0
print(c)

Fixed submission:
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)

Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)
c=0
i=0
f=0
while(1):
    if S[i] != S[i+1]:
	del S[i:i+2]
	c+=2
	N-=2
	i-=1
	f=1
    i+=1
    if i+1 == N:
	i=0
	if f==0:
            break
	f=0
print(c)

Fixed submission:
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

N = len(S)

S=list(S)

c=0
while(1):
    f=0
    for i in range(N-1):
        #print(i, S, N)                                                                  
        if S[i] != S[i+1]:
            del S[i:i+2]
            c+=2
            N-=2
            f=1
            break
    if f==0:
        break
print(c)

Fixed submission:
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)