Back to task

357 symbols python3
Thu Jan 4 02:28:33 2018 Sait2000
def F(t,x):
 w,[*r]=S(I());a=len(r);*p,=o=[' ']*a;n=1
 for s in S(S(I(),": ",1)[1],", "):
  e,b,*_=map(int,S(s,":")*2);d=b-e;p[~e:a-b]=-~d*'^'or"/%s\\"%("-"*~d);o[~e]=str(n);n+=1
  if x:t+=r[~e:a-b]
  else:r[~e:a-b],t=t[:1-d],t[1-d:]
 return[''.join(q).rstrip()for q in[w,o,p,r]+[t]*x]
I=input
S=str.split
*o,r=F([],1)
print(*o,"","="+r,"",*F(r,0),sep='\n')


Leave a comment

Parsed as Markdown

Login to leave a comment