s=input()

i=0
ban_list=[]
cnt=0
while(True):
    if len(s)<2:
        break
    elif i+1>=len(s):
        s1=""
        for j in range(len(s)):
            if j not in ban_list:
                s1+=s[j]
        s=s1
        i=0
    if len(s)<2:
        break
    elif s[i]!=s[i+1]:
        cnt+=1
        ban_list.append(i)
        ban_list.append(i+1)
        i=i+2
    else:
        i+=1
print(cnt*2)
        