S=str(input())
int_S=[]
for i in range(0,len(S)):
    int_S.append(int(S[i]))
global_count=0
count=1
while(count!=0):
    new_list=[]
    count=0
    i=0
    while(i<len(S)):
        if (i==len(S)-1):
            new_list.append(S[i])
            i+=1

        elif(S[i]!=S[i+1]):
            global_count+=2
            i+=2
            count+=1
        else:
            new_list.append(S[i])
            i+=1
    S=new_list
print(global_count)