#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 123;
const int INF = (int)1e9 + 123;
const double eps = 1e-6;
int diff, mn = INF;
string s, u;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> s;
  cin >> u;
  for (int i = 0; i < u.size(); i++) {
    s = "$" + s;
  }
  for (int i = 0; i < u.size(); i++) {
    s = s + "$";
  }
  for (int i = 0; i < s.size() - u.size() + 1; i++) {
    diff = 0;
    for (int k = 0; k < u.size(); k++) {
      diff += (s[k + i] != u[k]);
    }
    mn = min(mn, diff);
  }
  cout << mn;
  return 0;
}
