S = input()
if not len(S):
  print(0)
else:
  N = len(S)
  ans = 0
  while 1:
    S = S.replace('10', '')
    tmp1 = N - len(S)
    N = len(S)
    S = S.replace('01', '')
    tmp2 = N - len(S)
    N = len(S)
    if not tmp1 + tmp2:
      break
    else:
      ans += tmp1 + tmp2
  print(ans)