parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=chomp(readline())
    n=length(s)
    res=[0 for i in 1:n]
    cnt=0
    ans=0
    for i in 1:n
        cnt+=1
        res[i]=cnt
        ans+=1
        if cnt==3
            cnt=0
            ans-=1
        end
    end
    for i in 2:n
        if res[i]==2
            if s[i-1]==s[i]
                if i==n
                    ans-=1
                end
                continue
            else
                if s[i]!=s[i+1]
                    ans+=1
                end
            end
        end
    end
    println(ans)
end
main()