Back to task

362 symbols python3
Wed Jan 3 17:59:49 2018 Sait2000
def F(t,x):
 w,[*r]=S(I());*p,=o=[' ']*len(r);n=1
 for s in S(S(I(),": ",1)[1],", "):
  e,b,*_=map(int,S(s,":")*2);s=slice(~e,len(r)-b);d=e-b;p[s]=d>0and"/%s\\"%("-"*~-d)or"^";o[~e]=str(n);n+=1
  if x:t+=r[s]
  else:r[s],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