#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
template <typename first>
inline first abs(const first& a) {
  return a < 0 ? -a : a;
}
template <typename first>
inline first sqr(const first& a) {
  return a * a;
}
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-9;
const int INF = 1000 * 1000 * 1000;
const int N = 2000 + 13;
int n, m;
string s1, s2;
int main() {
  cin >> s1 >> s2;
  string tmp = string(2013, '#');
  s1 = tmp + s1 + tmp;
  n = int((s1).size());
  m = int((s2).size());
  int ans = m;
  for (int i = 0; i < int(n); i++) {
    int cntSame = 0;
    for (int j = 0; j < int(m); j++)
      if (i + j >= n)
        break;
      else {
        if (s1[i + j] == s2[j]) cntSame++;
      }
    ans = min(ans, m - cntSame);
  }
  cout << ans << endl;
  return 0;
}
