import queue
counter = 0
S = input()
S = list(S)
q = queue.Queue()
flg = 1
for i in range(len(S)):
  q.put(S[i])
for i in range(len(S)-1):
  if (flg == 1):
    s1 = q.get()
  s2 = q.get()
  if (s1 != s2):
    counter+=2
    flg = 1
  else:
    q.put(s1)
    s1 = s2
    flg = 0
print(counter)