let xs = stdin.ReadLine().ToCharArray()
let mutable i = 0
let mutable cnt = 0
let mutable cash = ""
while i < xs.Length do
    cnt <- cnt + 1
    if cash = string xs.[i] then
        if i = xs.Length - 4 && System.String.Concat [xs.[i];xs.[i+1]] = System.String.Concat [xs.[i+2];xs.[i+3]] then
            cash <- ""
            i <- i + 3
        else
            cash <- ""
            i <- i + 2        
    else
        if i = xs.Length - 2 && xs.[i] = xs.[i+1] then
            cnt <- cnt - 1
        cash <- string xs.[i]
        i <- i + 1
printfn "%d" cnt