s = gets.chomp
n = s.length
dp = Array.new(n+1){[0,0]}
dp[1][0] = 1
dp[2][1] = 1
1.upto(n-1) do |i|
  if s[i-1] == s[i]
    dp[i+1][0] = dp[i][1] + 1
  else
    dp[i+1][0] = dp[i].max + 1
  end
  if i >= 3 && s[i-3,2] == s[i-1,2]
    dp[i+1][1] = dp[i][0] + 1
  else
    dp[i+1][1] = dp[i-1].max + 1
  end
end
p dp[n].max