program dividing_a_string
  implicit none
  character(200000) :: s
  integer :: n, i, f(0:200000) = 0
  read(*,*) s
  n = len_trim(s)
  f(1) = 1
  if (n > 1) then
    if (s(1:1) == s(2:2)) then
      f(2) = 1
    else
      f(2) = 2
    end if
  end if
  do i = 3, n
    if (s(i:i) == s(i-1:i-1)) then
      f(i) = f(i-3)+2
    else
      f(i) = f(i-1)+1
    end if
  end do
  write(*,'(i0)') f(n)
end program dividing_a_string