compress letter rectangles by rolf

a=[]
try:
 while 1:a+=[list(raw_input())]
except:pass
w=len(a[0])
h=len(a)
W=[l.count(l[0])for l in zip(*a)]
H=[l.count(l[0])for l in a]
u=v=i=j=1
s=a[0][0]
while i<w or j<h:
 if i<w and u==W[i]:v+=1;s+=">"+a[0][i];i+=1
 if j<h and v==H[j]:u+=1;s+="v"+a[j][0];j+=1
print s

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

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page