MaxMinSwap by clock

loop{n=[a=eval(gets)]
(n[j=a.index(n[i=a.index(M)]=(a-[0]).min)]=M;a[i]=a[j]=0)while 0<M=a.max
puts"[#{n*','}]"}

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

download

return top