#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
const int N = 2222;
const int INF = 111111111;
const double eps = 1e-9;
const double pi = 3.14159265358979;
char s[N], u[N];
int n, m, ans = INF;
inline int check(int pos) {
  int res = 0;
  for (int i = 0; i < (m); i++) {
    if (pos + i < 0 || pos + i >= n) continue;
    if (s[pos + i] == u[i]) ++res;
  }
  return res;
}
int main() {
  gets(s);
  gets(u);
  n = strlen(s);
  m = strlen(u);
  for (int i = -m; i <= m + n; i++) ans = min(ans, m - check(i));
  printf("%d\n", ans);
  return 0;
}
