#include <bits/stdc++.h>
using namespace std;
char A[10000], B[10000];
int main() {
  scanf("%s%s", A, B);
  int i, j, k, la, lb, mi = 1000086;
  la = strlen(A);
  lb = strlen(B);
  for (i = -lb; i < la; i++) {
    int cnt = 0;
    for (j = 0, k = i; j < lb; ++j, ++k)
      if (k < 0 || k >= la || A[k] != B[j]) cnt++;
    if (mi > cnt) mi = cnt;
  }
  printf("%d", mi);
}
