#include <bits/stdc++.h>
using namespace std;
const int INFI = (1 << 30);
const long long INFL = (1LL << 62);
int main() {
  char a[9000], b[2010], ax[2010];
  for (int i = 0; i < 8000; i++) a[i] = 1;
  cin >> ax >> b;
  int n, m;
  m = strlen(ax);
  n = strlen(b);
  for (int i = 0; i < m; i++) a[i + 2000] = ax[i];
  a[8000] = 0;
  m = 8000;
  int mn = INFI;
  for (int i = 0; i < m && i + n - 1 < m; i++) {
    int s = 0;
    for (int j = i, t = 0; t < n; t++, j++)
      if (a[j] != b[t]) s++;
    mn = min(s, mn);
  }
  cout << mn;
  return 0;
}
