s = gets.chomp!.chars.map(&:to_s)
index = 0

while index <= (s.length - 2)
  if s[index] == s[index+1]
    if s[index+2].nil?
      s[index] = "#{s[index] + s[index+1]}"
      s[index+1, 1] = []
    else
      s[index+1] = "#{s[index+1] + s[index+2]}"
      s[index+2, 1] = []
      index += 1
    end
  end
  index += 1
end

p s.length
