#include <bits/stdc++.h>
using namespace std;
string s, u;
int j, i, n, m, ans, cur;
int main() {
  cin >> s;
  cin >> u;
  n = u.size();
  for (i = 1; i <= n + 1; i++) s = 'A' + s;
  for (i = 1; i <= n + 1; i++) s += 'A';
  m = s.size();
  ans = 100000;
  for (i = 0; i <= m - n; i++) {
    cur = 0;
    for (j = 0; j < n; j++) {
      if (u[j] != s[i + j]) cur++;
    }
    if (cur < ans) ans = cur;
  }
  cout << ans << endl;
}
