require 'pp'

chs = gets.chomp!.chars

ans = []

count = 1
head = 0
tail = 1
while chs.length >= 2
    ch1 = chs.shift
    ch2 = chs.shift
    if ch1 != ch2
        chs.unshift(ch2)
        ans << ch1
    else
        ch3 = chs.shift
        if ch3
            chs.unshift(ch2 + ch3)
            ans << ch1
        else
            chs.unshift(ch1 + ch2)
        end
    end

    #pp chs
    #pp ans
end

puts chs.length + ans.length
