#include <bits/stdc++.h>
using namespace std;
int calc(string a, string b) {
  int out = 0;
  for (int i = 0; i < a.size(); i++)
    if (a[i] != b[i]) out++;
  return out;
}
int main() {
  string str1, str2;
  cin >> str1 >> str2;
  for (int i = 0; i < str2.size(); i++) {
    str1 = " " + str1;
    str1 = str1 + " ";
  }
  int ans = 1e8;
  for (int i = 0; i < str1.size() - str2.size(); i++) {
    int temp = calc(str1.substr(i, str2.size()), str2);
    (temp < ans) ? ans = temp : ans = ans;
  }
  cout << ans << endl;
}
