Bead Sort by jingoro

a=gets p
w=a.index $/
?~.times{a.gsub!(/(\w)(.{#{w}})\|(.{#{w+1}})/m){'|'+$2+$1+$3}}
puts a

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

download

return top