Back to task

360 symbols python3
Wed Jan 3 18:29:14 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=e-b;p[~e:a-b]=d>0and"/%s\\"%("-"*~-d)or"^";o[~e]=str(n);n+=1
  if x:t+=r[~e:a-b]
  else:r[~e:a-b],t=t[:d+1],t[d+1:]
 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