#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int m = t.length();
  s = string(m - 1, '-') + s + string(m - 1, '-');
  int n = s.length();
  int ans = m;
  for (int i = 0; i < n; ++i) {
    int c = m;
    for (int j = 0; i + j < n && j < m; ++j) {
      if (s[i + j] == t[j]) --c;
    }
    if (c < ans) ans = c;
  }
  cout << ans;
  return 0;
}
