#include <bits/stdc++.h>
using namespace std;
char s[2222], u[2222];
int l, ll, ans;
int main() {
  gets(s);
  gets(u);
  l = strlen(s);
  ll = strlen(u);
  ans = ll;
  for (int j = -ll; j <= l; j++) {
    int cnt = 0;
    for (int i = 0; i < ll; i++) {
      if (i + j < 0 || i + j >= l)
        cnt++;
      else
        cnt += (s[i + j] != u[i]);
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
