function Main(input) {

	input = input.split("\n");
    
    let S = input[0];
    let T = input[1];
    
    let cnt = Infinity;
    
    for (let i = 0; i <= S.length - T.length; i++) {
        
        let str = S.substr(i, T.length);
        
        let diff = checkDiff(str, T);
        
        if (diff < cnt) cnt = diff;
        
    }
    
    console.log(cnt);
    
}

function checkDiff(str1, str2){
    
    if (str1.length != str2.length) return;
    
    let cnt = 0;
    
    for (let i = 0; i < str1.length; i++) {
        
        if (str1[i] != str2[i]) cnt++;
        
    }
    
    return cnt;
    
}


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