-- Atcoder https://atcoder.jp/contests/abc177/tasks/abc177_b

local bigString = io.read()
local smallString = io.read()

local function differenceCount(strA, strB)
    local c = 0
    for i = 1, #strA do
        if string.sub(strA, i, i) ~= string.sub(strB, i, i) then
            c = c + 1
        end
    end
    return c
end

local min = #smallString
for i = 1, #bigString - #smallString + 1 do
    local d = differenceCount(string.sub(bigString, i, i + #smallString - 1), smallString)
    if d < min then
        min = d
    end
end

print(min)