s = gets.chomp.chars
t = gets.chomp.chars
min = 1001
for i in 0..(s.size-t.size)
    count = 0
    for j in 0..(t.size - 1)
        if t[j] != s[i+j]
            count += 1
        end
    end
    if count < min
        min = count
    end
end
puts min