local s=io.read()
local t=io.read()
local min=math.maxinteger
for i=1,#s-#t+1 do
    local ss=s:sub(i,i+#t-1)
    local counter=0
    for j=1,#t do
        if ss:byte(j)~=t:byte(j) then
            counter=counter+1
        end
    end
    min=math.min(counter,min)
end
print(min)