local s = io.read()
local t = io.read()
local ret = 1000000007
for i = 1, #s - #t + 1 do
  local z = 0
  for j = i, i + #t - 1 do
    if s:byte(j) ~= t:byte(j - i + 1) then
      z = z + 1
    end
  end
  if z < ret then ret = z end
end
print(ret)
