const main = stdin => {
  const [S, T] = stdin.trim().split('\n')
  let max = 0
  for (let i = 0; i <= S.length - T.length; i++) {
    let count = 0
    for (let j = 0; j < T.length; j++) {
      if (S[i + j] === T[j]) {
        count++
      }
    }
    max = Math.max(count, max)
  }

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

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
