Commits

Kota UENISHI committed c6f17b9

160 stroke in golf competition

Comments (0)

Files changed (1)

+(* http://ocaml.jp/um2010
+   OCaml Meeting 2010 Golf competition code: 160 stroke.
+   http://golf.shinh.org/p.rb?Sort+by+Length+for+OCaml+Golf+Competition *)
 let rec(!)=String.length
-and g l=match try input_line stdin with _->""with""->l;|w->g(w::l)in
-List.map print_endline(List.sort(fun l r->match!l- !r with 0->compare l r|d->d)(g[]))
+and g l=match try read_line() with _->""with""->l;|w->g(w::l)in
+List.map print_endline(Sort.list(fun l r->(!l= !r)&l<r|| !l< !r)(g[]))