N = input()
found = True
count = 0
while found:
  found = False
  ng_list = []
  dummy = ""
  for i in range(len(N)):
    if i in ng_list:
      continue
    if i == len(N) -1:
      dummy += N[i]
      break
    if N[i] != N[i+1] and i not in ng_list:
      count += 2
      ng_list.append(i+1)
      found = True
      
    else:
      dummy += N[i]
  N = dummy
print(count)
    