s = input()
result = 0
while True:
  t = len(s)
  i = 0
  a = []
  while i < len(s) - 1:
    if s[i] != s[i + 1]:
      result += 2
      i += 1
    else:
      a.append(s[i])
    i += 1
  s = ''.join(a)
  if len(s) == t:
    break
print(result)
