function Main(input) {
  const lines = input.split('\n');
  const S = lines[0].split('');
  const T = lines[1].split('');
  let min = 10000;
  S.forEach((_, i) => {
    if (i + T.length <= S.length) {
      let count = 0;
      let pos = 0;
      while (true) {
        if (S[i + pos] !== T[pos]) count = count + 1;
        if (pos === T.length - 1) break;
        pos = pos + 1;
      }
      // console.log(S.slice(i, i + T.length));
      // console.log(T);
      // console.log(count);
      if (count < min) min = count; 
    }
  });
  console.log(min);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
