#include <bits/stdc++.h>
using namespace std;
int n, m, ans = 1 << 30;
string a, b, c;
int main() {
  cin >> c >> b;
  m = b.length();
  for (int i = 0; i < m; i++) a += '*';
  a += c;
  for (int i = 0; i < m; i++) a += '*';
  n = a.length();
  for (int i = 0; i <= n - m; i++) {
    int cnt = 0;
    for (int j = 0; j < m; j++)
      if (a[i + j] != b[j]) cnt++;
    ans = min(ans, cnt);
  }
  printf("%d\n", ans);
  return 0;
}
