Scanf.scanf "%s" (fun s -> let n = String.length s in let rec loop i = if i = n then "Done!" else if s.[i] = "AC,".[i mod 3] then loop (i + 1) else "Failed..." in loop 0 |> print_endline )