program prob3
    implicit none
    character(len=200005) :: s 
    integer :: ans
    character(len=2) :: tmp
    integer :: i

    read(*,*) s
    
    ans = 1
    tmp = s(1:1)
    do i = 2, len_trim(s)
        if(tmp == s(i:i)) then
            tmp = "aa"
        else if(tmp == "aa") then
            tmp = "ab"
            ans = ans + 1
        else
            tmp = s(i:i)
            ans = ans + 1
        end if
    end do
    
    
    write(*,*) ans
    stop
contains
end program prob3