include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
const int N = 1010;
int f[N][N];
int main()
{
char a[N],b[N];
scanf("%s %s",a+1,b+1);
int l1 = strlen(a+1);
int l2 = strlen(b+1);
memset(f,0x3f,sizeof f);
f[0][0] = 0;
for(int i = 1; i <= l1; i++)
{
f[i][0] = 0;
for(int j = 1; j <= l2; j++)
{
f[i][j] = f[i-1][j];
if(a[i] == b[j]) f[i][j] = min(f[i][j],f[i-1][j-1]);
else f[i][j] = min(f[i][j],f[i-1][j-1]+1);
}
}
printf("%d\n",f[l1][l2]);
return 0;
}