function main(lines) {
  const S = s();
  const T = s();
  
  const N = S.length;
  const M = T.length;
  let ans = N;
  for (let i = 0; i < N; i++) {
    let cnt = 0;
    for (let j = 0; j < M; j++) {
      if (S[i+j] == T[j]) cnt++;
    }
    ans = Math.min(ans, M-cnt);
  }
  
  return ans;
}



const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);
const getLines = (n) => lines.slice(lineCount, lineCount += n);

const ans = main(lines);
console.log( ans );