#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  long int i, j, cur, min = 10000000000ll;
  while (a.size() <= 2 * b.size()) {
    a = '.' + a;
  }
  while (a.size() <= 3 * b.size()) {
    a = a + '.';
  }
  for (i = 0; i < a.size() - b.size() + 1; ++i) {
    cur = 0;
    for (j = 0; j < b.size(); ++j) {
      if (a[i + j] != b[j]) {
        ++cur;
      }
    }
    if (cur < min) {
      min = cur;
    }
  }
  cout << min;
  return 0;
}
