#include <bits/stdc++.h>
using namespace std;
int in() {
  int a;
  scanf("%d", &a);
  return a;
}
double din() {
  double a;
  scanf("%lf", &a);
  return a;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
const double eps = 1e-8;
const int INF = 999999999;
int main() {
  string a, b;
  int k, h;
  cin >> a >> b;
  int res = 0;
  for (int i = 0; i < a.size(); ++i) {
    k = i;
    h = 0;
    for (int j = 0; j < b.size() && k < a.size(); ++j, ++k) {
      if (a[k] == b[j]) {
        h++;
        res = max(h, res);
      }
    }
  }
  for (int i = 0; i < b.size(); ++i) {
    k = i;
    h = 0;
    for (int j = 0; j < a.size() && k < b.size(); ++j, ++k) {
      if (b[k] == a[j]) {
        h++;
        res = max(h, res);
      }
    }
  }
  res = (int)b.size() - res;
  cout << res;
}
