S = list(map(int, list(input())))
length = len(S)
i = 0 
while len(set(S)) == 2:
  if 0 <= i < i + 1 < len(S):
    if S[i] + S[i+1] == 1:
      S = S[:i] + S[i+2:]
    else:
      i += 1
  else:
    i = 0
  
     
print(length - len(S))