#include <bits/stdc++.h>
char s[4005], u[4005];
int main() {
  memset(s, 0, sizeof s);
  memset(u, 0, sizeof u);
  scanf(" %s %s", s, u);
  int ls = strlen(s), lu = strlen(u);
  int max = 0;
  for (int i = 0; i <= ls; ++i) {
    int temp = 0;
    for (int j = 0; j < lu; ++j)
      if (s[i + j] == u[j]) ++temp;
    if (max < temp) max = temp;
  }
  for (int i = 0; i <= lu; ++i) {
    int temp = 0;
    for (int j = 0; j < ls; ++j)
      if (u[i + j] == s[j]) ++temp;
    if (max < temp) max = temp;
  }
  printf("%d", lu - max);
}
