#include<stdio.h>
#include<string.h>
#define MAX 100
int solve(char string1[], char string2[], int a, int b);
int min(int a, int b, int c);
int diff(char a, char b);
int main()
{
int a, b = 0;
char string1[MAX], string2[MAX];
scanf("%s", string1);
a = strlen(string1);
scanf("%s", string2);
b = strlen(string2);
printf("%d\n",solve(string1, string2, a, b));
}
int solve(char string1[], char string2[], int a, int b){
int d[a + 1][b + 1], i ,j;
if(a == b && (a == 0 || a == 1))return 0;
for(i = 0, j = 0; i < a + 1; i++)d[i][j] = i;
for(i = 0, j = 0; j < b + 1; j++)d[i][j] = j;
for(i = 1; i <= a; i++){
for(j = 1; j <= b; j++){
d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + diff(string1[i - 1],string2[j - 1]));
}
}
return d[a][b];
}
int min(int a, int b, int c){
if(a < b && a < c)return a;
if(b < a && b < c)return b;
if(c < a && c < b)return c;
}
int diff(char a, char b){
if(a == b)return 0;
if(a != b)return 1;
}
#include<string.h>
#define MAX 100
int solve(char string1[], char string2[], int a, int b);
int min(int a, int b, int c);
int diff(char a, char b);
int main()
{
int a, b = 0;
char string1[MAX], string2[MAX];
scanf("%s", string1);
a = strlen(string1);
scanf("%s", string2);
b = strlen(string2);
printf("%d\n",solve(string1, string2, a, b));
}
int solve(char string1[], char string2[], int a, int b){
int d[a + 1][b + 1], i ,j;
if(a == b && (a == 0 || a == 1))return 0;
for(i = 0, j = 0; i < a + 1; i++)d[i][j] = i;
for(i = 0, j = 0; j < b + 1; j++)d[i][j] = j;
for(i = 1; i <= a; i++){
for(j = 1; j <= b; j++){
d[i][j] = min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + diff(string1[i - 1],string2[j - 1]));
}
}
return d[a][b];
}
int min(int a, int b, int c){
if(a < b && a < c)return a;
if(b < a && b < c)return b;
if(c < a && c < b)return c;
}
int diff(char a, char b){
if(a == b)return 0;
if(a != b)return 1;
}