s=list(input())   
adj=-1
op=0

while(adj==-1):
    adj=0
    for i in range(1,len(s)):
        if(s[i]!=s[i-1]):
            adj=-1
            del(s[i], s[i-1])
            op+=2
            break
         
print(op)
