#include <bits/stdc++.h>
using namespace std;
const int maxn = 2003;
char a[maxn];
char b[maxn];
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int i, j;
  int la, lb;
  scanf("%s%s", a, b);
  la = strlen(a);
  lb = strlen(b);
  int ans = 0;
  for (i = 0; i < la; i++) {
    int tmp = 0;
    for (j = 0; i + j < la && j < lb; j++) {
      tmp += a[i + j] == b[j];
    }
    ans = max(ans, tmp);
  }
  for (i = lb - 1; i >= 0; i--) {
    int tmp = 0;
    for (j = 0; i - j >= 0; j++) {
      tmp += a[i - j] == b[lb - 1 - j];
    }
    ans = max(ans, tmp);
  }
  printf("%d\n", lb - ans);
  return 0;
}
