program prob2
    implicit none
    integer::i, l, cnt, k, j
    character(len=200005)::S
    character(len=2)::a
    read(*,*) S
    l = len_trim(S)

    a = S(1:1)
    cnt = 1
    i = 2
    do while(i <= l)
        k = len_trim(a)
        if(k > 1) then
            a = S(i:i)
            i = i+1
            cnt = cnt + 1
        else
            if(S(i:i) .ne. a(1:1)) then
                a = S(i:i)
                i = i+1
            else if(i /= l) then
                a = S(i:i+1)
                i = i+2
            else
                exit
            end if
            cnt = cnt + 1
        end if
    end do

    write(*,*) cnt
    stop
end program prob2