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)