s = gets.chomp.chars

ans_a = 0

b = ""
i = 0
while i < s.size - 1 do
  if i == s.size - 2
    if s[i] == s[i+1]
      ans_a += 1
    else
      ans_a += 2
    end
    break
  elsif s[i] == b
    b = s[i..(i+1)]
    i += 2
  else
    b = s[i]
    i += 1
  end
  ans_a += 1
end

ans = 0
b = ""
i = s.size - 1
while i > 0 do
  if i <= 1
    if s[i] == s[i-1]
      ans += 1
    else
      ans += 2
    end
    break
  elsif s[i] == b
    b = s[(i-1)..i]
    i -= 2
  else
    b = s[i]
    i -= 1
  end
  ans += 1
end


puts [ans_a, ans].max
