Sort by Length for OCaml Golf Competition by croyal

l=[]
try:
 while 1:l+=[raw_input()]
except:l.sort(cmp=lambda x,y:len(x)==len(y) and cmp(x,y) or len(x)-len(y))
print'\n'.join(l)

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

download

return top