#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int INF = 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
int main() {
  ios ::sync_with_stdio(false);
  string s1, s2;
  cin >> s1 >> s2;
  int ans = INF, len = s2.size();
  s1 = string(len, '+') + s1 + string(len, '+');
  for (int i = 0; i <= s1.size() - s2.size(); ++i) {
    int cnt = 0;
    for (int j = 0; j < s2.size(); ++j)
      if (s1[i + j] != s2[j]) ++cnt;
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
