s = STDIN.read.chomp

def count(s)
  if s.length <= 1
    0
  else
    i = 0
    found = false
    while i <= s.length - 2
      if s[i] != s[i + 1]
        found = true
        break
      end

      i += 1
    end

    if found
      lh = (i == 0) ? '' : s[0..(i - 1)]
      rh = (i + 2 >= s.length) ? '' : s[(i + 2)..-1]
      2 + count(lh + rh)
    else
      0
    end
  end
end

out = count(s)

puts out
