require 'pp'

s = gets.chomp!
t = gets.chomp!

index = 0

max = 0
0.upto(s.length - t.length) do |i|
    cnt = 0
    s[i, t.length].chars.each_with_index do |ch, j|
        if ch == t[j]
            cnt += 1
        end
    end    

    if max < cnt
        max = cnt
    end
end

puts t.length - max
