S = list(input())

skip = 0
count = 0
no_count = 1
k = 0
s = []
N = len(S)
while k < 1:
  no_count = 1
  for i in range(len(S)-1):
    #print([S[i], S[i+1]])
    if skip == 0:
      if S[i] != S[i+1]:
        count += 1
        skip = 1
        no_count = 0
      else:
        s.append(S[i])
        if i == len(S) - 2:
          s.append(S[-1])
    else:
      skip = 0
      if i == len(S) - 2:
        s.append(S[-1])
  else:
    #print(s)
    if no_count == 1:
      print(count * 2)
      break
    else:
      S = s[:]
      s = []
  