#include <bits/stdc++.h>
using namespace std;
int main() {
  int l1, l2, i, j, x, c;
  string s1, s2;
  cin >> s1;
  cin >> s2;
  l1 = s1.length();
  l2 = s2.length();
  x = l2;
  for (i = -l2; i < l1; i++) {
    c = 0;
    for (j = 0; j < l2; j++) {
      if (c > x) break;
      if ((i + j < 0) || (i + j >= l1) || (s1[i + j] != s2[j])) c++;
    }
    if (c < x) x = c;
  }
  cout << x << endl;
  return 0;
}
