Luke Two by bk1e

n=1
while gets
w=[n.to_s]+split
while (z=w.size)>0
0.upto(z){|h|i=z-h
v=w[0..i]
o=v.join(' ')
if o.size<=40
if i<z
f=(40.0-v.join.size)/i
o=w[0]
e=0
1.upto(i){|j|s=f*j-e
e+=s.to_i
o+=(' '*s)+w[j]}
end
puts o
w[0..i]=[]
break
end}
end
n+=1
end

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

download

return top