from collections import deque
s=input()
d=deque(s)
ans=deque([])
ans.append(d[0])
c=0
for i in range(len(s)):
    if ans==[]:
        ans.append(d[i])
    elif ans[-1]==d[i]:
        ans.append(d[i])
    else:
        ans.pop()
        c+=2
print(c)