#include <bits/stdc++.h>
int main() {
  std::string s, p;
  std::cin >> s >> p;
  int a = p.size(), t = s.size(), u, i, j, n;
  for (u = a, i = 0; i < u + t; ++i, a = n < a ? n : a)
    for (n = j = 0; j < u; ++j)
      n += (i + j >= u && i + j < u + t) ? (s[i + j - u] != p[j]) : 1;
  printf("%d\n", a);
  return 0;
}
