#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size(), ans = 0;
  for (int i = -m, j = 0; i < n; i++, j++) {
    int count = 0;
    for (int k = max(i, 0); k <= min(j, n - 1); k++)
      if (s[k] == t[k - i]) count++;
    ans = max(ans, count);
  }
  cout << m - ans << endl;
  return 0;
}
