#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  for (int i = 0; i < (int)v.size(); i++) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}
void debug() { cerr << "\n"; }
template <typename T, typename... Args>
void debug(T x, Args... args) {
  cerr << x << "; ";
  debug(args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s, u;
  cin >> s >> u;
  int ret = INT_MAX;
  string master(u.length(), '$');
  master += s;
  for (int i = 0; i < master.length(); i++) {
    int tot = 0;
    for (int j = 0; j < u.length(); j++)
      tot += (i + j >= master.length() || master[i + j] != u[j]);
    ret = min(ret, tot);
  }
  cout << ret << "\n";
  return 0;
}
