#include <bits/stdc++.h>
using namespace std;
const int maxs = 2e3 + 5;
int lengthStr, lengthW;
string str, wanted;
int main() {
  cin >> str;
  cin >> wanted;
  lengthW = wanted.length();
  int cnt = lengthW;
  for (int i = 0; i < lengthW; i++) str = '#' + str;
  for (int i = 0; i < lengthW; i++) str += '#';
  lengthStr = str.length();
  for (int i = 0; i <= lengthStr - lengthW; i++) {
    int sum = 0;
    for (int j = 0; j < lengthW; j++)
      if (str[i + j] != wanted[j]) sum++;
    cnt = min(sum, cnt);
  }
  printf("%d\n", cnt);
  return 0;
}
