#include <bits/stdc++.h>
using namespace std;
template <class T>
void pp(T v) {
  for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it)
    cout << *it << ' ';
  cout << endl;
}
template <class T>
void pp(T v, int n) {
  for (int i = 0; i < (int)n; i++) cout << v[i] << ' ';
  cout << endl;
}
template <class T>
inline void chmax(T &a, const T b) {
  a = max(a, b);
}
template <class T>
inline void chmin(T &a, const T b) {
  a = min(a, b);
}
const int INF = 1 << 28;
const double EPS = 1.0e-9;
static const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int diff(const string &s1, const string &s2) {
  int res = 0;
  for (int i = 0; i < s1.size(); i++)
    if (s1[i] != s2[i]) res++;
  return res;
}
int main(void) {
  string s1, s2;
  cin >> s1 >> s2;
  int len2 = s2.size();
  s1 = string(len2 - 1, '#') + s1 + string(len2 - 1, '#');
  int len1 = s1.size();
  int ans = 10000 * 10000;
  for (int left = 0; left <= len1 - len2; left++) {
    int work = (int)diff(s1.substr(left, len2), s2);
    chmin(ans, work);
  }
  cout << ans << endl;
  return 0;
}
