#include <bits/stdc++.h>
using namespace std;
string s, u;
int l, ls, mmin, d;
int main() {
  cin >> s >> u;
  l = u.size();
  mmin = l;
  for (int i = 0; i < l; ++i) s = "." + s + ".";
  ls = s.size();
  for (int i = 0; i < ls - l; ++i) {
    d = 0;
    for (int j = 0; j < l; ++j)
      if (s[i + j] != u[j]) ++d;
    if (d < mmin) mmin = d;
  }
  cout << mmin;
  return 0;
}
