s = gets.rstrip
n = s.size

dp = Array.new(n + 1) { Array.new(3, 0) }

dp[0][1] = 0
dp[0][2] = 0
dp[1][1] = 1
dp[1][2] = 0

1.upto(n - 1) do |i|
  if i + 1 < n
    if s[i] != s[i+1]
      dp[i+1][1] = [dp[i][1], dp[i][2]].max + 1
    else
      dp[i+1][1] = dp[i][2] + 1
    end
  end
  
  if i + 2 < n
    if s[(i-1)..i] != s[(i+1)..(i+2)]
      dp[i+2][2] = [dp[i][1], dp[i][2]].max + 1
    else
      dp[i+2][2] = dp[i][1] + 1
    end
  end
end


p dp[n - 1].max
