#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000000 + 7;
const long long int MOD1 = 998244353;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s, t;
  cin >> s >> t;
  long long int m = t.size();
  long long int ans = m;
  for (long long int i = (long long int)0; i < (long long int)2010; i++)
    s = '@' + s;
  for (long long int i = (long long int)0; i < (long long int)2010; i++)
    s = s + '@';
  long long int n = s.size();
  for (int i = 0; i + m < n; i++) {
    long long int ctr = 0;
    for (int j = 0; j < m; j++) {
      if (s[i + j] != t[j]) ctr++;
    }
    ans = min(ans, ctr);
  }
  cout << ans << "\n";
}
