#include <bits/stdc++.h>
using namespace std;
void loadData(void);
int proc(void);
void printRes(int);
char input[2001];
string s, u;
string getBlankStr(int len);
int diff(const string &s1, const string &s2);
int main(int argc, char **argv) {
  loadData();
  printRes(proc());
  return 0;
}
string getBlankStr(int len) {
  string res = "";
  for (int i = 0; i < len; i++) res += " ";
  return res;
}
int diff(const string &s1, const string &s2) {
  int res = 0;
  for (int i = 0; i < s1.size(); i++)
    if (s1[i] != s2[i]) res++;
  return res;
}
int proc(void) {
  string blankStr = getBlankStr(u.size());
  s = blankStr + s + blankStr;
  int res = 2001;
  for (int i = 0; i <= s.size() - u.size(); i++)
    res = min(res, diff(s.substr(i, u.size()), u));
  return res;
}
void loadData(void) {
  char enter;
  scanf("%s%c", input, &enter);
  s = input;
  scanf("%s%c", input, &enter);
  u = input;
  return;
}
void printRes(int res) {
  printf("%d\n", res);
  return;
}
