const input = require("fs").readFileSync("/dev/stdin", "utf8")

const lines = input.split('\n')
let S = lines[0].trim()
let T = lines[1].trim()

let diff = Infinity

const f = (a, b) => {
    let count = 0
    for (let i = 0; i < a.length; i++) {
        if (a[i] !== b[i]) count++
    }
    return count
}

for (let i = 0; i < S.length - T.length + 1; i++) {
    diff = Math.min(diff, f(S.substr(i, T.length), T))
}

console.log(diff)
