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)