Scanf.scanf "%s" (fun s ->
    let n = String.length s in
    let rec loop i plen acc =
        if i = n then acc else
            if plen = 2 then loop (i + 1) 1 (acc + 1) else
                if s.[i] <> s.[i - 1] then loop (i + 1) 1 (acc + 1) else
                    if i = n - 1 then acc else loop (i + 2) 2 (acc + 1)
    in
    loop 1 1 1 |> Printf.printf "%d\n"
)
