#include <bits/stdc++.h>
using namespace std;
int solve(void) {
  string S, U;
  cin >> S >> U;
  int res = U.length();
  for (int i = 0; i < (int)U.length(); i++) S = "." + S + ".";
  int szu = U.length(), szs = S.length();
  for (int i = 0; i < (int)S.length(); i++) {
    if (i + szu == szs) break;
    int cnt = 0;
    for (int j = 0; j < (int)szu; j++) {
      cnt += S[i + j] != U[j];
    }
    res = min(res, cnt);
  }
  printf("%d\n", res);
  return 0;
}
int main(void) {
  solve();
  return 0;
}
