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

maxfit = [0]
s.length.times do |si|
  tempcnt = 0
  break if s.length < si + t.length
  t.length.times do |ti|
    break if si >= s.length
    if s[si] == t[ti]
      tempcnt += 1
    end
    si += 1
  end
  maxfit.push(tempcnt)
end
p t.length - maxfit.max