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

min=t.length

(0..s.length-t.length).each do |p|
    cnt=0
    t.each_index {|i|
        cnt+=1 if t[i]!=s[p+i]
    }
    min = cnt if cnt < min
end

puts min
