#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60000000")
using namespace std;
string S, Z, ff, cur;
int main() {
  cin >> S;
  cin >> cur;
  for (int i = 0; i < cur.size(); i++) Z += 'Z';
  ff = Z + S + Z;
  int ans = cur.size() + 1;
  int curans = 0;
  for (int i = 0; i <= ff.size() - cur.size(); i++) {
    curans = 0;
    for (int j = 0; j < cur.size(); j++)
      if (ff[i + j] != cur[j]) curans++;
    ans = min(ans, curans);
  }
  cout << ans << endl;
  return 0;
}
