import re
pattern = re.compile('01|10')

def remove(tower, count):
  m = pattern.split(tower)
  operation = len(m) - 1
  print(count * 2) if operation == 0 else remove(''.join(m), count + operation)  

count = 0
remove(input(), count)
