q=x=c='' while q>0: try:u=0;b=' |-+';s=raw_input(c)+'\n';a=c;c=q except:q=0 for y in s:v=(a[1:2]!=y)*2;t=x!=y;b+=b[u]+b[(a>b)|t|u|v];c+=b[t]+y;x=y;a=a[2:];u=v print b[5:]

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