#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  string r;
  cin >> s >> t;
  r = t;
  for (int i = 0; i < t.length(); i++) {
    r[i] = '.';
  }
  s = r + s + r;
  int mn = 10000000;
  for (int i = 0; i + t.length() - 1 < s.length(); i++) {
    int count = 0;
    for (int j = 0; j < t.length(); j++) {
      if (s[i + j] != t[j]) {
        count++;
      }
    }
    mn = (mn < count) ? (mn) : (count);
  }
  cout << mn << endl;
  return 0;
}
