#include <bits/stdc++.h>
const int INF = 0x7fffffff;
const double inf = 1e8;
const double eps = 1e-10;
const double PI = acos(-1.0);
const int Max = 3001;
char p[Max], q[Max];
using namespace std;
int main() {
  int l, n, i, j;
  cin >> p >> q;
  l = strlen(p);
  n = strlen(q);
  int m = 0;
  for (i = -n + 1; i < l; i++) {
    int t = 0;
    for (j = 0; j < n; j++) {
      if (i + j < l && i + j >= 0 && p[i + j] == q[j]) t++;
    }
    if (t > m) m = t;
  }
  cout << n - m;
}
