s = gets.chomp.split("").map(&:to_s);
t = gets.chomp.split("").map(&:to_s);

n = (s.length) - (t.length)+1
time=Array.new(n,0)

for i in 0..n-1 do
	for j in 0..(t.length-1) do
		if s[i+j] == t[j] then
			time[i]+=1
		end
	end
end

p (t.length) - time.max