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

result=[]

(s.length - t.length + 1).times do |i|
  a = 0
  t.length.times do |j|
    unless t[j] == s[i+j]
      a += 1
    end
  end
  result << a
end

p result.min