function Main(s, t) {
  let min = 1000;
  for (let i = 0; i <= s.length - t.length; i++) {
    let change = t.length;
    for (let j = 0; j < t.length; j++) {
      if (s.charAt(i + j) == t.charAt(j)) {
        change--;
      }
    }
    if (change < min) min = change;
  }
  return min;
}

function readlines() {
  return require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
}

(async () => {
  const lines = readlines();
  console.log(await Main(lines[0], lines[1]));
})();