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

(0..(s.size - t.size)).each do |i|
  cnt = 0
  t.length.times do |j|
    if s[i+j] != t[j]
      cnt += 1
    end
  end
  res = [res, cnt].min
end
puts res