#include <bits/stdc++.h>
using namespace std;
string p, q;
int n, m, ans;
int main() {
  cin >> p >> q;
  m = q.length();
  for (int i = 0; i < m; i++) p = '.' + p + '.';
  n = p.length();
  ans = 1000000000;
  for (int i = 0; i < n; i++) {
    if (i + m >= n) break;
    int k = 0;
    for (int j = 0; j < m; j++) k += (p[i + j] != q[j]);
    ans = min(ans, k);
  }
  cout << ans << endl;
}
