S = input()
if not len(S):
  print(0)
else:
  N = len(S)
  ans = 0
  while '10' in S or '01' in S:
    S = S.replace('10', '')
    ans += N - len(S)
    N = len(S)
    S = S.replace('01', '')
    ans += N - len(S)
    N = len(S)
  print(ans)