str = []
str =gets.chomp.chars

i = 0
j = 1
while i < (str.length-1) do
	if str[i] == str[i+1]
		i = i+1
		if str[i+1] == str[i+2] && str[i+2] == str[i+3]
			i = i + 2 
		end	
	end
	i = i+ 1
    j = j +1
end

puts j