#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
int main() {
  string s, u;
  cin >> s >> u;
  string t = "";
  for (int i = 0; i < (int)u.length() - 1; ++i) t += "#";
  s = t + s + t;
  int best = INF;
  for (int i = 0; i + u.length() <= s.length(); ++i) {
    int cur = 0;
    for (int j = 0; j < u.length(); ++j)
      if (s[i + j] != u[j]) cur++;
    best = min(best, cur);
  }
  printf("%d\n", best);
  return 0;
}
