s = gets.chop
t = gets.chop

def compare_string(a, b) 
  res = 0
  a.length.times do |i|
    if a[i] != b[i] 
      res += 1  
    end
  end
  return res
end

ans = 1005
(s.length - t.length + 1).times do |i|
  c = compare_string(t, s[i, t.length])
  if c < ans
    ans = c
  end
end

puts(ans)