#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int t1, t2, t3;
int main() {
  ios_base::sync_with_stdio(0);
  t3 = 1061109567;
  cin >> s1 >> s2;
  string s3 = "";
  for (int i(0), _n(((int)(s2.size()))); i < _n; ++i) s3 += "$";
  s3 += s1;
  for (int i(0), _n(((int)(s2.size()))); i < _n; ++i) s3 += "$";
  s1 = s3;
  for (int i(0), _n(((int)(s1.size()))); i < _n; ++i) {
    t1 = 1061109567;
    if (i + ((int)(s2.size())) <= ((int)(s1.size()))) {
      t1 = 0;
      for (int j(0), _n(((int)(s2.size()))); j < _n; ++j) {
        t1 += s2[j] != s1[i + j];
      }
    }
    t3 = min(t3, t1);
  }
  cout << t3 << endl;
}
