s = gets.chomp.split("")
t = gets.chomp.split("")

min = Float::INFINITY

(0 .. s.size - t.size).each{ |i|
	count = 0
	
	t.each_with_index{ |tt, j|
		if tt != s[i, t.size][j] then
			count += 1
		end
	}
	
	if min > count then
		min = count
	end
}

puts min
