let rec($)l a=try l$read_line()::a with _->List.map print_endline(List.sort(fun c d->2*(l c-l d)+compare c d)a);;String.length$[]
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page