#include <bits/stdc++.h>
int main() {
  char in[6000] = {0}, out[2002] = {0};
  int i, j = 0, min = 2000, n, m, k = 0, p = 0;
  scanf("%s%s", &in[2000], &out);
  n = strlen(in);
  m = strlen(out);
  min = m;
  for (i = 0; i < 6000 - m; i++) {
    int s = 0;
    for (j = 0; j < m; ++j)
      if (out[j] != in[i + j]) ++s;
    if (s < min) min = s;
  }
  printf("%d\n", min);
  return 0;
}
