s=input()
l=[]
for ak in range(len(s)):
    l.append(s[ak])
no=[]
s=l
no.append(s[0])
br=0
for i in range(1,len(s)):
    no.append(s[i])
   
    if no[-1]!=no[-2]:
        no.pop(-1)
        no.pop(-1)
        br+=2
print(br)
