import 'dart:io';

import 'dart:math';

List<String> getStdStr() => stdin.readLineSync().split(' ');
List<int> getStdInt() {
  var strings = getStdStr();
  List<int> outs = [];
  for (var out in strings) {
    outs.add(int.parse(out));
  }
  return outs;
}

void main() {
  var S = getStdStr();
  var T = getStdStr();
  int ret = T[0].length;
  for (var i = 0; i < S[0].length - T[0].length + 1; ++i) {
    String tmpstr = S[0].substring(i, i + T[0].length);
    ret = min(ret, chkDiff(tmpstr, T[0]));
  }
  print(ret);
}

int chkDiff(String str1, String str2) {
  int ret = 0;
  int size = max(str1.length, str2.length);
  for (var i = 0; i < size; ++i) {
    if (str1[i] != str2[i]) {
      ret++;
    }
  }
  return ret;
}
