#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string a, b;
  cin >> a >> b;
  int n = a.size(), m = b.size();
  for (long long i = 0; i < m; i++) {
    a = '*' + a + '*';
  }
  n += 2 * m;
  int ans = m;
  for (long long i = 0; i < n - m; i++) {
    int k = 0;
    for (long long j = 0; j < m; j++) {
      if (b[j] != a[i + j]) {
        k++;
      }
    }
    ans = min(ans, k);
  }
  cout << ans;
}
