function main(arg) {
    
    let s = arg.split("\n")[0]
    let t = arg.split("\n")[1]
    //console.log(s)
    
    
    let ans = 10000
    for(let i=0; i < s.length; i++) {
        let tmp = 0
        for(let j=0; j < t.length; j++) {
            if(s[i+j] != t[j]) {
                tmp++
            }
        }
        ans = Math.min(ans, tmp)
    }
    if(ans==10000)ans = 0
    console.log(ans)
}

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