s=str(input())

p1 = '01'
p2 = '10'
s = s[::-1]
c = 0
flag = True
while flag:
  flag = False
  for i in range(len(s)):
    if s[i:i+4] in ('0011','1100','1010','0101','1001','0110'):
      s = s[:i] + s[i+4:]
      c += 4
      flag = True
      break
    
    
    if s[i:i+2] in (p1,p2):
      s = s[:i] + s[i+2:]
      c += 2
      flag = True
      break
print(c)