s = gets.strip

# ランレングスの配列を作る
# "aabbaa" => [2, 2, 2]
run_length = s.chars.chunk {|c| c}.map {|c, arr| arr.size}

count = []

run_length.size.times do |i|
    now_length = run_length[i]
    next_length = run_length[i + 1]

    if next_length.nil?
        count << 1
        break
    end

    if now_length >= 2 && next_length >= 2
        count << 2
        run_length[i + 1] -= 1
    else
        count << 1
    end
end

puts count.inject(:+)