let () =
  let s = read_line () in
  let dp = Array.make_matrix (String.length s) 2 min_int in
  dp.(0).(0) <- 1;
  dp.(0).(1) <- min_int;
  dp.(1).(0) <- if s.[0] = s.[1] then min_int else 2;
  dp.(1).(1) <- 1;
  for i = 2 to String.length s - 1 do
    dp.(i).(0) <-
      1 +
      if s.[i - 1] = s.[i]
      then dp.(i - 1).(1)
      else max dp.(i - 1).(0) dp.(i - 1).(1);
    dp.(i).(1) <- 1 + dp.(i - 2).(0)
  done;
  Printf.printf "%d\n" @@
  max dp.(String.length s - 1).(0) dp.(String.length s - 1).(1)
