#include <bits/stdc++.h>
using namespace std;
void solveA() {
  string s, u;
  cin >> s >> u;
  string add;
  for (int i = 0; i < u.size(); ++i) add += '#';
  string str = add;
  str.append(s);
  str.append(add);
  int res = -1;
  for (int i = 0; i + u.size() - 1 < str.size(); ++i) {
    int cnt = 0;
    for (int j = 0; j < u.size(); ++j) {
      if (u[j] == str[i + j]) cnt++;
    }
    if (res == -1 || res > u.size() - cnt) res = u.size() - cnt;
  }
  cout << res << endl;
}
int main() { solveA(); }
