var S ="cabacc";
var T ="abc";
var answer = T.length;

for(var i = 0; i <= S.length - T.length; i++){
    
    var count = 0;
for(var j = 0; j < T.length; j++){
    if(T[j] !== S[j+i]){
        count++;
    }
}
if(answer > count){
    answer = count;
}
}
document.write(answer);