#include <bits/stdc++.h>
using namespace std;
int comp(string s1, string s2) {
  int l1 = s1.length();
  for (int i = 0; i < l1; i++) s2 = '$' + s2;
  int l2 = s2.length();
  int counter = 20001;
  for (int i = 0; i < l2; i++) {
    int temp = 0;
    for (int j = 0; j < l1; j++)
      if (i + j < l2) {
        if (s1[j] == s2[i + j]) {
          temp++;
        }
      }
    if (l1 - temp < counter) counter = l1 - temp;
  }
  return counter;
}
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  cout << comp(s2, s1);
  return 0;
}
