#include <bits/stdc++.h>
using namespace std;
int main() {
  string p, s;
  cin >> s >> p;
  int sl = s.length();
  int pl = p.length();
  s = p + s + p;
  for (int i = 0; i < pl; ++i) {
    s[i] = '*';
    s[sl + pl + i] = '*';
  }
  int min = sl + pl;
  for (int i = 0; i < sl + pl; ++i) {
    int ans = 0;
    for (int j = 0; j < pl; ++j) {
      if (s[i + j] != p[j]) ++ans;
    }
    if (ans < min) min = ans;
  }
  cout << min << endl;
  return 0;
}
