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

ans = 0
def kesu(s, ans):
  for ni in range(len(s)-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