s = gets.chomp.split("")
t = gets.chomp.split("")
tlen = t.length
slen = s.length
min = 10000
(slen-tlen+1).times do |i|
  cnt = 0
  tlen.times do |j|
    if s[i+j] != t[j]
      cnt += 1
    end
  end
  min = [cnt,min].min
end
puts min