#include <bits/stdc++.h>
using namespace std;
void divideByZero(const char *error) {
  printf(error);
  fclose(stdout);
  int a = 234;
  a = a / (a - a);
}
long parseLong() {
  long temp;
  scanf("%ld", &temp);
  return temp;
}
char s[3000], u[3000];
int main() {
  scanf("%s", &s);
  scanf("%s", &u);
  long n = strlen(u), m = strlen(s);
  long mindiff = n;
  for (long d = -n; d <= m; d++) {
    long diff = 0;
    for (long i = 0; i < n; i++)
      if (i + d >= 0 && i + d < m && u[i] == s[i + d])
        continue;
      else
        diff++;
    mindiff = min(diff, mindiff);
  }
  printf("%ld", mindiff);
  return 0;
}
