Borderizing Texts by hallvabo

B,_='|_'
J=B.join
a=raw_input().split()
f=lambda z,c:'\n|'+J(3%z*c+J((len(w)+z)/2*c)+(len(w)+z)%2*c for w in a)+'|\n'
print' '+_*~-sum(len(x)+3for x in a)+f(3,' ')+B,' | '.join(a),B+f(2,_)

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

download

return top