#include <bits/stdc++.h>
using namespace std;
char s1[2211], s2[2211];
int main() {
  scanf("%s%s", s1, s2);
  int l1 = strlen(s1);
  int l2 = strlen(s2);
  int ans = 0;
  int ma = 0;
  for (int i = -l2; i < l1; i++) {
    ans = 0;
    for (int j = i, k = 0; j < l1 && j < i + l2 && k < l2; j++, k++) {
      if (j >= 0 && s1[j] == s2[k]) {
        ans++;
      }
    }
    ma = max(ma, ans);
  }
  cout << l2 - ma << endl;
  return 0;
}
