s = gets.chop
t = gets.chop
d = t.length
(s.length - t.length).times do |idx|
  count = 0
  s[idx, t.length].chars.each.with_index do |c, cidx|
    count += 1 if c != t[cidx]
  end
  d = [d, count].min
end
puts d