program prob3
    implicit none
    character(len=200005) :: s
    integer, allocatable :: dp1(:), dp2(:)
    integer :: n, m

    read(*,*) s
    n = len_trim(s)
    allocate(dp1(n))
    allocate(dp2(n))
    
    dp1(1) = 1
    dp1(2) = 1
    dp2(1) = 0
    dp2(2) = 1
    if(s(1:1) /= s(2:2)) then
        dp1(2) = dp1(2) + 1
    end if

    do m = 3, n
        if(s(m-1:m-1) == s(m:m)) then
            dp1(m) = dp2(m-1) + 1
        else
            dp1(m) = max(dp1(m-1) + 1, dp2(m-1) + 1)
        end if
        if(m == 3) then
            dp2(m) = dp1(m-2) + 1
        else if(s(m-3:m-2) == s(m-1:m)) then
            dp2(m) = dp2(m-2) + 1    
        else
            dp2(m) = max(dp1(m-2) + 1, dp2(m-2) + 1)
        end if
    end do

    write(*,*) max(dp1(n), dp2(n))

    deallocate(dp2)    
    deallocate(dp1)
    stop
contains
end program prob3