#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int ans = 10000000;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> s1 >> s2;
  reverse(s1.begin(), s1.end());
  for (register int i = 0; i < 2000; i++) s1 += "0";
  reverse(s1.begin(), s1.end());
  for (register int i = 0; i < s1.size(); i++) {
    int counter = 0;
    for (register int j = 0; j < s2.size(); j++) {
      if (s1[i + j] != s2[j]) counter++;
    }
    ans = min(ans, counter);
  }
  cout << ans;
}
