#include <bits/stdc++.h>
using namespace std;
string extend_string(string s, int n) {
  string appendix = "";
  for (int i = 0; i < n; ++i) appendix += "$";
  return appendix + s + appendix;
}
int count_diff(string str1, string str2) {
  int n = str1.length();
  int counter = 0;
  for (int i = 0; i < n; ++i) {
    if (str1[i] != str2[i]) counter++;
  }
  return counter;
}
int main() {
  string s, u;
  cin >> s;
  cin >> u;
  int n_len = s.length();
  int u_len = u.length();
  int min_change = u_len;
  s = extend_string(s, u_len);
  for (int i = 1; i < n_len + u_len; ++i) {
    string v = s.substr(i, u_len);
    if (count_diff(u, v) < min_change) min_change = count_diff(u, v);
  }
  cout << min_change << "\n";
  return 0;
}
