#include <bits/stdc++.h>
using namespace std;
int ans = 1e9;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  if (s1.length() < s2.length()) {
    for (int i = -int(s2.length()) + 1; i < int(s1.length()); i++) {
      int cnt = 0;
      for (int j = 0; j < int(s2.length()); j++)
        if (i + j >= 0 && j + i < int(s1.length()) && s1[j + i] == s2[j]) cnt++;
      int cur = int(s2.length()) - cnt;
      ans = min(ans, cur);
    }
    cout << ans << endl;
    return 0;
  } else {
    for (int i = -int(s2.length()); i < int(s1.length()); i++) {
      int cnt = 0;
      for (int j = 0; j < int(s2.length()); j++)
        if (i + j >= 0 && j + i < int(s1.length()) && s2[j] == s1[i + j]) cnt++;
      int cur = int(s2.length()) - cnt;
      ans = min(ans, cur);
    }
    cout << ans << endl;
    return 0;
  }
  return 0;
}
