#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, u;
  cin >> s >> u;
  int ans = int(u.size());
  for (int i = 0; i < int(u.size()) - 1; i++) s = "." + s + ".";
  for (int i = 0; i < int(s.size()); i++)
    if (i + int(u.size()) <= int(s.size())) {
      int x = 0;
      for (int j = 0; j < int(u.size()); j++) x += (s[i + j] != u[j]);
      ans = min(ans, x);
    }
  cout << ans << endl;
}
