list input n2 len list input m2 len m2 for in range n2 for in range m2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
n = list(input());n2 = len(n)
m = list(input());m2 = len(m)
a = [[0]*(m2+1) for i in range(n2)]
a[0] = [i for i in range(m2+1)]
for i in range(n2):
a[i][0] = i
for i in range(1,n2):
for j in range(1,m2+1):
if n[i-1] == m[j-1]: a[i][j] = a[i-1][j-1]
else: a[i][j] = min(a[i-1][j],a[i-1][j-1],a[i][j-1]) + 1
print(a[-1][-1])