#include <bits/stdc++.h>
int main() {
  std::string S;
  std::string U;
  std::cin >> S >> U;
  int s_len = S.length();
  int u_len = U.length();
  int max = 0;
  int cur = 0;
  for (int i = -u_len + 1; i < s_len; i++) {
    cur = 0;
    for (int j = std::max(0, i); j - i < u_len && j < s_len; j++) {
      if (S[j] == U[j - i]) {
        cur++;
      }
    }
    if (cur > max) {
      max = cur;
    }
  }
  std::cout << u_len - max << std::endl;
}
