#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, u;
  cin >> s >> u;
  string temp;
  for (int i = 0; i < (int)u.length(); ++i) temp += '#';
  temp += s;
  for (int i = 0; i < (int)u.length(); ++i) temp += '#';
  int min = (int)u.length();
  for (int i = 0; i <= (int)temp.length() - (int)u.length() + 1; ++i) {
    int count = 0;
    for (int j = i; j - i < (int)u.length(); ++j)
      count += (temp[j] != u[j - i]);
    if (count < min) min = count;
  }
  cout << min;
  return 0;
}
