s = [int(i) for i in list(str(input()))]
n = len(s)

if s != [0]:
  ans = 0
  def kesu(s, ans):
    for ni in range(n-1):
      if ni+1 >= len(s):
        return s, ans
      if s[ni] != s[ni+1]:
        del s[ni:ni+2]
        ans += 2
    return s, ans

  while True:
    l = len(s)
    s, ans = kesu(s, ans)
    if len(s) == l:
      print(ans)
      break
else:
  print(0)