You are viewing a single comment's thread. Return to all comments →
Here is a templete I wrote to handle input/output in OCaml because I had difficulty without any templete in OCaml, while a templete for Scala is provided.
I hope this might be of some help for OCaml users. If you find any mistakes or anything to rewrite, please let me know.
let rec intlst_of_strlst lst =
match lst with
first::rest -> int_of_string(first)::intlst_of_strlst(rest)
|  -> 
let () =
let str = read_line() in
let lst = Str.split (Str.regexp "[ \t]+") str in
let d = intlst_of_strlst lst in
let xy = Array.of_list d in
let ans = gcd xy.(0) xy.(1) in