#include <bits/stdc++.h>
using namespace std;
int coincidencias(string &s, string &u) {
  int ns = int(s.size());
  int nu = int(u.size());
  int maximo = 0;
  for (int i = 0; i + nu - 1 < ns; i++) {
    int coin = 0;
    for (int j = 0; j < nu; j++) {
      if (u[j] == s[i + j]) coin++;
    }
    maximo = max(maximo, coin);
  }
  for (int i = 0; i < nu and i < ns; i++) {
    int coin = 0;
    for (int j = 0; j <= i; j++) {
      if (s[j] == u[nu - 1 - i + j]) coin++;
    }
    maximo = max(maximo, coin);
  }
  for (int i = 0; i < nu and i < ns; i++) {
    int coin = 0;
    for (int j = 0; j <= i; j++) {
      if (s[ns - 1 - i + j] == u[j]) coin++;
    }
  }
  return maximo;
}
int main() {
  string s, u;
  cin >> s >> u;
  int maximo = max(coincidencias(s, u), coincidencias(u, s));
  cout << int(u.size()) - maximo << endl;
}
