#include <bits/stdc++.h>
using namespace std;
const int MaxLen = 1000 + 5;
string s, u;
int main(void) {
  cin >> s >> u;
  int LenU = u.length();
  for (int i = 0; i < LenU; i++) s = "*" + s;
  int LenS = s.length();
  int Sol = LenU;
  for (int i = 0; i < LenS; i++) {
    int Cnt = 0;
    for (int j = 0; j < LenU; j++) {
      if (i + j == LenS) break;
      if (s[i + j] == u[j]) Cnt++;
    }
    Sol = min(LenU - Cnt, Sol);
  }
  cout << Sol << endl;
  return 0;
}
