from collections import deque

s=input()
sd=deque(s)
d=deque()
while(len(sd)>0):
  crr = sd.popleft()
  if(len(d)<1):
    d.append(crr)
    continue
    if(len(d)>=1 and d[-1]!=crr):
      d.pop()
      else:
        d.append(crr)
print(len(s)-len(d))