let input = "codeforces\natcoder";

function main(input){
  input = input.trim();
  list = input.split("\n");
  let d = list[0];
  let s = list[1];
  let answer = 1000;
  let temp = 0;
  for(let i=0; i<d.length - s.length + 1; i++){
    temp = 0;
    for(let j=0; j<s.length; j++){
      let dStr = d.substr(i+j,1);
      let sStr = s.substr(j,1);
      if(dStr===sStr){
        //console.log(dStr + " " + sStr + " onaji");
      }else{
        //console.log(dStr + " " + sStr + " tigau");
        temp++;
      }
    } // j loop
    if(temp < answer){answer = temp;}
    //console.log(temp);
  } // i loop
  if(d===s){answer=0;}
  console.log(answer);
}
main(input);
//main(require("fs").readFileSync("/dev/stdin","utf8"));