#include <bits/stdc++.h>
using namespace std;
long long min(long long a, long long b) { return a < b ? a : b; }
int main() {
  string x, y;
  cin >> x >> y;
  int s1 = x.size();
  int s2 = y.size();
  long long max = -1;
  for (long long start = 0; start <= x.size() - 1; start++) {
    long long count = 0;
    for (long long i = start; i <= min(start + y.size() - 1, x.size() - 1); i++)
      if (x[i] == y[i - start]) count++;
    if (count > max) max = count;
  }
  for (long long start = 0; start <= y.size() - 1; start++) {
    long long count = 0;
    for (long long i = start; i <= min(start + x.size() - 1, y.size() - 1); i++)
      if (y[i] == x[i - start]) count++;
    if (count > max) max = count;
  }
  cout << y.size() - max;
  return 0;
}
