#include <bits/stdc++.h>
using namespace std;
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << endl;
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long MOD = 1000 * 1000 * 1000 + 7;
const long long NMAX = 10000 * 1000 + 111111;
string s, v;
void solve() {
  cin >> s >> v;
  long long n_old = v.length();
  s = v + s + v;
  long long n = s.length();
  long long ans = 1e18;
  for (long long i = 0; i < s.length(); i++) {
    long long cnt = 0;
    for (long long j = 0; j < v.length(); j++) {
      if (i + j < n_old || i + j >= s.length() - n_old)
        cnt++;
      else if (s[i + j] == v[j])
        continue;
      else
        cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
