c='' q=1 while q: try:u=0;b=' |-+';s=x=input(c)+'\n';a=c;c='' 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).