#include <bits/stdc++.h>
int n, m;
char a[10000];
char b[10000];
int main() {
  scanf("%s %s", a, b);
  n = strlen(a);
  m = strlen(b);
  int minn = 10000000;
  for (int i = -m + 1; i < n; i++) {
    int count = 0;
    for (int j = 0; j < m; j++) {
      if (i + j < 0 || i + j >= n) {
        count++;
      } else if (a[i + j] != b[j])
        count++;
    }
    if (count < minn) minn = count;
  }
  printf("%d\n", minn);
}
