s = gets.chomp
t = gets.chomp

delta = s.length - t.length
ans = 9999

def difference(s, t)
  tmp = 0
  s.length.times do |i|
    tmp += 1 if s[i] != t[i]
  end

  return tmp
end

delta.times do |i|
  tmp = difference(s[i..(i+t.length - 1)], t)
  ans = [ans, tmp].min
end

puts ans