#include <bits/stdc++.h>
using namespace std;
char sa[2004], sb[2004];
int an, bn;
int common(const char* a, const char* b) {
  int i, j;
  for (i = 0, j = 0; a[i] && b[i]; j += a[i] == b[i], i++)
    ;
  return j;
}
int main() {
  int n, i, len;
  while (scanf("%s %s", sa, sb) == 2) {
    an = strlen(sa);
    bn = strlen(sb);
    len = 0x7fffffffL;
    for (i = 0; i < an; i++) {
      int d;
      d = common(sa + i, sb);
      len = ((len) < (((bn - d) < 0 ? -(bn - d) : (bn - d)))
                 ? (len)
                 : (((bn - d) < 0 ? -(bn - d) : (bn - d))));
    }
    for (i = 0; i < bn; i++) {
      int d;
      d = common(sa, sb + i);
      len = ((len) < (((bn - d) < 0 ? -(bn - d) : (bn - d)))
                 ? (len)
                 : (((bn - d) < 0 ? -(bn - d) : (bn - d))));
    }
    printf("%d\n", len);
  }
  return 0;
}
