#include <bits/stdc++.h>
using namespace std;
int l1, l2;
char s1[2005], s2[2005];
int f(int x, int y) {
  int i, l = 0;
  for (i = 0; i + x < l1 && i + y < l2; i++)
    if (s1[i + x] == s2[i + y]) l++;
  return l;
}
int main() {
  int i, l, d;
  scanf("%s%s", s1, s2);
  l1 = strlen(s1);
  l2 = strlen(s2);
  l = 0;
  for (i = 0; i < l1; i++) {
    d = f(i, 0);
    if (l < d) l = d;
  }
  for (i = 0; i < l2; i++) {
    d = f(0, i);
    if (l < d) l = d;
  }
  printf("%d\n", l2 - l);
  return 0;
}
