s = input()
n = len(s)
answer = 0
while 1:
  answer += s.count("01")*2
  s = s.replace("01","")
  answer += s.count("10")*2
  s = s.replace("10","")
  if n == len(s):
    break
  else:
    n = len(s)
print(answer)