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=split(chomp(readline()),"")
    i=2
    while i<length(s)
        if s[i]==s[i-1]
            s[i]*=s[i+1]
            s=vcat(s[1:i],s[i+2:end])
        end
        i+=1
    end
    i=2
    while i<length(s)
        if s[i]==s[i+1]
            s[i]=s[i-1]*s[i]
            s=vcat(s[1:i-2],s[i:end])
        end
        i+=1
    end
    println(length(s))
end
main()