divide rectangles by rolf

J=" ".join
s=[0]
while 1:
 l=raw_input()
 if l[0]not in"+|":x,y=map(int,l.split());q=(len(s[1])-2)/y;a=[J(["+"+q*"-"+"+"]*y)];print"\n".join((a+(len(s)-3)/x*[J(["|"+q*" "+"|"]*y)]+a)*x);s=[]
 s+=[l]

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

download

return to the top page