S = input()
N = len(S)

for i in range(int(len(S)/2)):
  zero_i = S.find("01")
  one_i = S.find("10")
  if zero_i > -1:
    S = S[:zero_i] + S[zero_i+2:]
  elif one_i > -1:
    S = S[:one_i] + S[one_i+2:]
  else:
    break

print(N - len(S))