#include <bits/stdc++.h>
int main() {
  std::string a, b, s(2000, '*');
  std::cin >> a >> b;
  int j, u, i = 0, r = 1e4;
  a = s + a + s;
  for (i = 0; i < a.size(); i++) {
    for (u = j = 0; j < b.size();) u += a[i + j] != b[j++];
    r = r < u ? r : u;
  }
  std::cout << r;
}
