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

max = 0

s.size.times do |i|
  count = 0
  t.size.times do |j|
    if s[i+j].nil?
      break
    end
    if s[i+j]==t[j]
      count += 1
    end
  end
  if max < count
    max = count
  end
end

puts("#{t.size-max}")