IMPOSSIBLE = -9999999

s = gets.chomp
length = s.length

if length == 1
  puts(1)
  exit
end

dp = Array.new(2) { Array.new(length, 0) }

dp[0][0] = 1
dp[1][0] = IMPOSSIBLE
dp[0][1] = (s[0] == s[1]) ? IMPOSSIBLE : 2
dp[1][1] = 1

(2..(length-1)).each do |i|
  dp[0][i] = dp[1][i-1] + 1
  dp[0][i] = dp[0][i-1] + 1 if (s[i-1] != s[i]) && (dp[0][i] < dp[0][i-1] + 1)
  dp[1][i] = dp[0][i-2] + 1
  dp[1][i] = dp[1][i-2] + 1 if (s[i-3, 2] != s[i-1, 2]) && (dp[1][i] < dp[1][i-2] + 1)
end

puts([dp[0][length-1], dp[1][length-1]].max)