#include <bits/stdc++.h>
using namespace std;
string source, target;
int main() {
  cin >> source >> target;
  source = string(target.size(), ' ') + source + string(target.size(), ' ');
  int ret = target.size();
  for (int i = 0; i < source.size() - target.size(); i++) {
    int diff = 0;
    for (int j = 0; j < target.size(); j++)
      if (source[i + j] != target[j]) diff++;
    ret = ((ret) < (diff) ? (ret) : (diff));
  }
  cout << ret << endl;
  return 0;
}
