#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  int mini = 99999;
  cin >> s1;
  cin >> s2;
  for (int i = 0; i != s2.size(); i++) s1 = "*" + s1 + "*";
  int cnt;
  for (int i = 0; i != s1.size() - s2.size() + 1; i++) {
    cnt = 0;
    for (int j = 0; j < s2.size(); j++) {
      if (s1[i + j] != s2[j]) cnt++;
    }
    mini = min(mini, cnt);
  }
  cout << mini << endl;
  return 0;
}
