#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, u;
  cin >> s >> u;
  int N = s.size(), M = u.size();
  int answer = N + M;
  for (int i = 1 - M; i < N; ++i) {
    int score = 0;
    for (int j = 0; j < M; ++j) {
      if (i + j < 0) {
        ++score;
      } else if (i + j >= N) {
        ++score;
      } else if (s[i + j] != u[j]) {
        ++score;
      }
    }
    answer = min(score, answer);
  }
  cout << answer << endl;
  return 0;
}
