#include <bits/stdc++.h>
using namespace std;
char a[2000], b[2000];
int main() {
  cin >> a >> b;
  int alen = strlen(a);
  int blen = strlen(b);
  int num = blen;
  int cnt = 0;
  for (int i = 0; i < alen + blen; i++) {
    cnt = 0;
    for (int j = 0; j < blen; j++) {
      if ((i + j) >= blen && i + j < alen + blen) {
        if (a[i + j - blen] != b[j]) cnt++;
      } else
        cnt += 1;
    }
    num = min(num, cnt);
  }
  cout << num << endl;
}
