#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, u;
  cin >> s >> u;
  for (int i = 0; i < u.length(); i++) s = '#' + s;
  int k = s.length();
  for (int i = 0; i < u.length() * 2; i++) s += '#';
  int m = 0;
  for (int i = 0; i < k; i++) {
    int tmp = 0;
    for (int j = 0; j < u.length(); j++)
      if (s[i + j] == u[j]) tmp++;
    if (tmp > m) m = tmp;
  }
  cout << u.length() - m;
  cin >> m;
}
