function Main(input) {
	input = input.trim().split("\n").map(function(x) { return x.split(" ")});
	let S = input[0][0];
	let T = input[1][0];
	
	let ans = Infinity;
	let tmp;
	for (let i = 0; i <= S.length - T.length; i++){
		tmp = 0;
		for (let j = 0; j < T.length; j++){
			if(S[i + j] !== T[j]) tmp ++;
		}
		ans = Math.min(ans, tmp);
	}

	console.log(ans);
}

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