(* 1. *) let rec spell ((i,j),mot) = if mot = "" then [] else let deb = String.sub mot 0 1 in let fin = String.sub mot 1 (String.length mot -1) in ((i,j),deb)::(spell ((i,j+1),fin));; (* 2. *) let scan_h (m,n) = let rec aux (i,j) = (i,j)::(if j=n then if i=m then [] else aux (i+1,1) else aux (i,j+1) ) in aux (1,1);; (* 3. *) let scan_v (m,n) = List.map (function (i,j) -> (j,i)) (scan_h (n,m));; (* 4. *) let rec letters sol = match(sol) with [] -> [] | t::r -> (spell t) @ (letters r);; (* 5. *) let rec size sol = match(letters sol) with [] -> (0,0) | ((i,j),_)::r -> let (i',j') = size r in ((if i>i' then i else i'), (if j>j' then j else j'));;