function Main(input) {
  input = input.split("\n");
  const S = input[0].split("");
  const T = input[1].split("");

  var def = 0;

  for(var i = 0; i <= S.length - T.length; i++){
    var tmp = S.slice(i, i + T.length);
    
    var count = 0; //一致数
    for(var j = 0; j < tmp.length; j++){
      if(tmp[j] == T[j]){
        count++
      }
    }
    
    if(count > def){
      def = count;
    }
  }
  
  console.log(T.length - def);
  
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));