Sort by Length for OCaml Golf Competition by *yuko*

character*99s(999),c;do i=1,999;read(*,*,end=1),s(i)
do j=1,i;c=s(i);if(adjustr(c)>adjustr(s(j)))goto2;s(i)=s(j);s(j)=c
2 enddo;enddo;1 print'(a)',(trim(s(i)),i=1,i-1);end

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

download

return to the top page