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