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;
}

async function readline() {
  return new Promise((resolve, reject) => {
    const reader = require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    });
    reader.on('line', line => {
      resolve(line)
    });
  });
}

(async () => {
  console.log(Main(await readline(), await readline()));
})();