#include <bits/stdc++.h>
using namespace std;
int main() {
  string t1, t2;
  cin >> t1 >> t2;
  string tmp;
  for (int i = 0; i < 2000; ++i) tmp += " ";
  t1 = tmp + t1 + tmp;
  int mx = 0;
  for (int i = 0; i + t2.size() <= t1.size(); ++i) {
    int cnt = 0;
    for (int j = 0; j < t2.size(); ++j) cnt += (t2[j] == t1[j + i]);
    mx = max(mx, cnt);
  }
  cout << t2.size() - mx << endl;
}
