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