s = gets.chomp.chars

ans = 0
prev = nil
while s.size > 0
  tmp = s.shift
  if s.size < 2 && tmp == s[0]
    tmp += s.shift
    ans += 1
    break
  end
  if s.size < 1
    ans += 1
    break
  end
  if tmp == prev
    tmp += s.shift
    if tmp == s[0]
      tmp += s.shift
    end
  end
  prev = tmp
  ans += 1
end

puts ans