import sys
s = sys.stdin.readline().strip()
t = sys.stdin.readline().strip()
# 长度
m = len(s)
n = len(t)
# 初始化
dp = [ [0] * (n + 1) for _ in range(m + 1) ]
for i in range(m + 1):
for j in range(n + 1):
if i == 0:
dp[0][j] = j
continue
if j == 0 :
dp[i][0] = i
continue
if s[i - 1] != t[j - 1]:
dp[i][j] = min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]) + 1
else:
dp[i][j] = dp[i - 1][j - 1]
print(dp[m][n])



京公网安备 11010502036488号