#include <bits/stdc++.h>
template <typename T>
T inline SQR(const T &a) {
  return a * a;
}
template <typename T>
T inline ABS(const T &a) {
  return a < 0 ? -a : a;
}
const double EPS = 1e-9;
inline int SGN(double a) {
  return ((a > EPS) ? (1) : ((a < -EPS) ? (-1) : (0)));
}
inline int CMP(double a, double b) { return SGN(a - b); }
using namespace std;
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  string s, u;
  cin >> s;
  cin >> u;
  int m = int((u).size());
  int ans = m;
  for (int i = 0; i < m - 1; ++i) s = "Z" + s + "Z";
  int n = int((s).size());
  for (int i = 0; i < n; ++i) {
    int from = i;
    int j = 0;
    int dif = 0;
    while (j < m) {
      if (s[from] != u[j]) dif++;
      from++;
      j++;
    }
    ans = min(ans, dif);
  }
  cout << ans << "\n";
  return 0;
}
