#include <bits/stdc++.h>
using namespace std;
int digitcount(int n) {
  int result = 0;
  for (int i = n; i > 0; i /= 10) {
    result++;
  }
  return result;
}
int power(int a, int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  return a * power(a, b - 1);
}
int main() {
  string s, u;
  cin >> s >> u;
  int count = INT_MAX;
  int len = u.size();
  s = string(len, '@') + s + string(len, '@');
  for (int i = 0; i < s.size() - u.size(); i++) {
    int temp = 0;
    for (int j = 0; j < u.size(); j++) {
      if (s[i + j] != u[j]) temp++;
    }
    if (temp < count) count = temp;
  }
  cout << count << endl;
}
