s = gets.rstrip
n = s.size

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

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

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

  if dp[i-1][2] != -1
    kouho << dp[i-1][2] + 1
  end

  dp[i][1] = kouho.max

  kouho = [-1]
  last2 = i >= 3 ? s[i-3..i-2] : ''
  if dp[i-2][2] != -1 && last2 != s[i-1..i]
    kouho << dp[i-2][2] + 1
  end

  if dp[i-2][1] != -1
    kouho << dp[i-2][1] + 1
  end

  dp[i][2] = kouho.max
end

# dp.each do |a|
#   p a
# end

p dp[n-1].max
