f=open("sisend1.txt") a=" "+f.readline().strip() b=" "+f.readline().strip() ridu=len(a) veerge=len(b) f.close() d=[[9]*veerge for reanr in range(ridu)] for reanr in range(ridu): d[reanr][0]=reanr for veerunr in range(veerge): d[0][veerunr]=veerunr for reanr in range(1, ridu): for veerunr in range(1, veerge): if a[reanr]==b[veerunr]: d[reanr][veerunr]=d[reanr-1][veerunr-1] else: d[reanr][veerunr]=min( d[reanr-1][veerunr], d[reanr][veerunr-1], d[reanr-1][veerunr-1])+1 print(" "+b) for reanr in range(ridu): print(a[reanr]+"".join([str(nr) for nr in d[reanr]])) print(a, b, d[ridu-1][veerge-1]) f2=open("valjund1.txt","w") f2.write(str(d[ridu-1][veerge-1])) f2.close()