s = input()

count = 0

def str_del(str,index):
    str = str[:index]+str[index+1:]
    return str

def remove_cube(string):
  for i in range(0, len(string)):
    print(len(string))
    if i+1 >= len(string):
      return string
    elif string[i] != string[i+1]:
      string = str_del(string, i)
      string = str_del(string, i)
      return string

string = s
can_remove = True
while can_remove:
  removed = remove_cube(string)
  if removed != string:
    string = removed
    count += 2
    can_remove = True
  else:
    can_remove = False

print(count)
