#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 4;
const long long MAXN = 1000000 + 10;
long long gcd(long long a, long long b) {
  while (a > 0 && b > 0)
    if (a > b)
      a %= b;
    else
      b %= a;
  return a + b;
}
long long power(long long x, unsigned int y) {
  long long temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if ((y % 2) == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
int main() {
  string a, b;
  cin >> a >> b;
  string q = "";
  for (int i = 0; i < 2005; i++) q += '!';
  a = q + a + q;
  int ok = 100000;
  for (int i = 0; i <= a.length() - b.length(); i++) {
    int ans = 0;
    for (int j = 0; j < b.length(); j++)
      if (b[j] != a[i + j]) ans++;
    ok = min(ans, ok);
  }
  cout << ok;
}
