function Main(input){
    let s = (input.split("\n")[0]).split("");
    let t = (input.split("\n")[1]).split("");
    let ans = t.length;
    for(let a = 0; a < s.length - t.length + 1; a++){
        let diff = 0;
        for(let b = 0; b < t.length; b++){
            if(t[b] != s[a+b]){
                diff++;
            }
        }
        ans = Math.min(diff, ans);
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));