#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, u;
  cin >> s >> u;
  int n = s.length();
  int m = u.length();
  int b = 0;
  for (int i = 0; i < n; i++) {
    int c = 0;
    for (int j = 0; j < min(m, n - i); j++) {
      if (u[j] == s[i + j]) c++;
    }
    b = max(b, c);
  }
  for (int i = 0; i < m; i++) {
    int c = 0;
    for (int j = 0; j < min(n, m - i); j++) {
      if (s[j] == u[i + j]) c++;
    }
    b = max(b, c);
  }
  cout << m - b << endl;
  return 0;
}
