#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a;
  cin >> b;
  string add(2000, '*');
  a = add + a + add;
  int len1 = a.size(), len2 = b.size();
  int ans = 10000;
  for (int i = 0; i < a.size(); i++) {
    int num = 0;
    for (int j = 0; j < b.size();) {
      num += (a[i + j] != b[j++]);
    }
    ans = min(ans, num);
  }
  cout << ans << endl;
  return 0;
}
