s = gets.chomp.split('')
t = gets.chomp.split('')

sLen = s.size
tLen = t.size

best = 0
0.upto(sLen - tLen) do |si|
    cnt = 0
    tLen.times do |ti|
        cnt += 1 if s[si + ti] == t[ti]
    end
    best = [best, cnt].max
end

puts (tLen - best)