let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const src = readLine();
  const target = readLine();
  let max = Number.MIN_SAFE_INTEGER;

  for (let i = 0; i <= src.length - target.length; i++) {
    let count = 0;
    for (let j = 0; j < target.length; j++) {
      const srcChar = src[i + j];
      const targetChar = target[j];
      if (srcChar === targetChar) count++;
    }
    max = Math.max(max, count);
  }

  console.log(target.length - max);
}
