#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
int main() {
  string s, u;
  cin >> s >> u;
  string dummy(u.size() - 1, '@');
  s = dummy + s + dummy;
  int res = u.size();
  for (int i = 0; i + u.size() <= s.size(); ++i) {
    int mis = 0;
    for (int j = 0; j < u.size(); j++) mis += u[j] != s[i + j];
    res = min(res, mis);
  }
  cout << res << endl;
}
