#include <bits/stdc++.h>
using namespace std;
const int maxn = 2600;
string s, t;
int smax;
int main() {
  while (cin >> s >> t) {
    smax = -1 << 10;
    int lens = s.length();
    int lent = t.length();
    for (int i = 0; i < lent; i++) {
      s += "#";
      s = "#" + s;
    }
    for (int i = 0; i < lens + lent; i++) {
      int num = 0;
      for (int j = 0; j < lent; j++)
        if (s[i + j] == t[j]) num++;
      smax = max(smax, num);
    }
    if (lent - smax > 0)
      cout << lent - smax << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
