Scanf.scanf "%s %d" (fun s w ->
    let n = String.length s in
    let rec loop i acc =
        if i >= n then acc else
            loop (i + w) (Printf.sprintf "%s%c" acc s.[i])
    in
    loop 0 "" |> print_endline
)