Sort by Length for OCaml Golf Competition by uru

#define F(i)for i:=1to n do
var i,n:word;s:array[0..999]of string;t:string;begin
repeat
inc(n);readln(t);str(length(t):2,t,s[n])until eof;F(i)F(n)if s[n-1]>s[n]then begin
t:=s[n-1];s[n-1]:=s[n];s[n]:=t end;F(i)writeln(copy(s[i],3))end.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page