#include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) #define INF 1<<30 #define MP make_pair #define mp make_pair #define pb push_back #define PB push_back #define DEBUG(x) cout<<#x<<": "<>n>>m; cin>>s>>t; int dp[n+1][m+1];fill((int*)dp,(int*)dp+(n+1)*(m+1),INF); dp[0][0]=0; REP(i,n+1) dp[i][0]=i; REP(i,m+1) dp[0][i]=i; FOR(i,1,n+1){ FOR(j,1,m+1){ if(s[i-1]==t[j-1]) dp[i][j]=min(dp[i][j],dp[i-1][j-1]); if(s[i-1]!=t[j-1]) dp[i][j]=min(dp[i][j],dp[i-1][j-1]+1); dp[i][j] = min(dp[i][j],dp[i-1][j]+1); dp[i][j] = min(dp[i][j],dp[i][j-1]+1); } } cout<