#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using llf = long double;
const lli M = 1e9 + 7;
const int N = 1e5 + 10;
const int L = 19;
const int D = 5 * 101;
const int INF = 1 << 30;
int main() {
  ios_base::sync_with_stdio(false);
  string a, b;
  cin >> a >> b;
  int answer = b.size();
  string s = "";
  for (int i = 0; i < b.size(); ++i) s += "#";
  s += a;
  for (int i = 0; i < b.size(); ++i) s += "#";
  a = s;
  for (int i = 0; i + b.size() <= a.size(); ++i) {
    int la = b.size();
    for (int j = 0; j < b.size(); ++j) la -= b[j] == a[i + j];
    answer = min(la, answer);
  }
  cout << answer;
  return 0;
}
