#include <bits/stdc++.h>
using namespace std;
int matches, start;
string s, u;
int match(int start) {
  int ans = 0;
  int poz = 0;
  while (start < s.size() && poz < u.size()) {
    if (s[start] == u[poz]) ++ans;
    ++start;
    ++poz;
  }
  return ans;
}
int match2(int start) {
  int ans = 0;
  int poz = 0;
  while (start < u.size() && poz < s.size()) {
    if (u[start] == s[poz]) ++ans;
    ++start;
    ++poz;
  }
  return ans;
}
int main() {
  cin >> s >> u;
  start = 0;
  while (start < s.size()) {
    matches = max(matches, match(start));
    ++start;
  }
  start = 0;
  while (start < u.size()) {
    matches = max(matches, match2(start));
    ++start;
  }
  cout << u.size() - matches << '\n';
}
