#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int s1 = a.size();
  int s2 = b.size();
  int ans = 2010;
  int ss = s2;
  for (int i = 1; i < s2; i++) {
    int num = 0;
    for (int k = i, j = 0; k < s2 && j < s1; k++, j++) {
      if (b[k] == a[j]) num++;
    }
    ans = min(ans, ss - num);
  }
  for (int i = 0; i < s1; i++) {
    int num = 0;
    for (int k = i, j = 0; j < s2 && k < s1; j++, k++) {
      if (a[k] == b[j]) num++;
    }
    ans = min(ans, ss - num);
  }
  cout << ans;
  return 0;
}
