#include <bits/stdc++.h>
using namespace std;
char S0[2100];
char S[10100];
char U[2100];
int n, m;
int main() {
  gets(S0);
  gets(U);
  n = strlen(S0);
  m = strlen(U);
  int c = m - 1;
  for (int i = 0; i < (n); ++i) {
    S[i + c] = S0[i];
  }
  for (int i = 0; i < (c); ++i) {
    S[i] = S[c + n + i] = '.';
  }
  n += c + c;
  int res = 1000000000;
  for (int k = 0; k < (n - m + 1); ++k) {
    int v = 0;
    for (int i = 0; i < (m); ++i) {
      if (S[i + k] != U[i]) ++v;
    }
    res = min(res, v);
  }
  cout << res;
  return 0;
}
