#include <bits/stdc++.h>
using namespace std;
long long const MAX = 2147483647, REALMAX = 9223372036854775806;
const int N = 2e3;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s, u, s2;
  int sum = 0, mini = N;
  cin >> s >> u;
  for (long long i = (0); i < (N); i++) s2 += ' ';
  s2 += s;
  for (long long i = (0); i < (N); i++) s2 += ' ';
  s = s2;
  for (long long i = (0); i < (s.size() - u.size()); i++) {
    sum = 0;
    for (long long j = (i); j < (i + u.size()); j++) {
      if (s[j] != u[j - i]) sum++;
    }
    mini = min(mini, sum);
  }
  cout << mini;
}
