local min = math.min

local s = io.read()
local t = io.read()

local s_byte_t = {}
for i = 1, s:len() do
	s_byte_t[i] = s:byte(i)
end
local t_byte_t = {}
for i = 1, t:len() do
	t_byte_t[i] = t:byte(i)
end

local out = math.maxinteger
for i = 0, #s_byte_t - #t_byte_t do
	local count = 0
	for j = 1, #t_byte_t do
		if s_byte_t[i + j] ~= t_byte_t[j] then
			count = count + 1
		end
	end
	out = min(out, count)
end

print(out)
