s = gets.chomp.split('')
t = gets.chomp.split('')
motosize = t.size
max = 0

def hoge(a, b)
  count = 0
  for i in 0...(a.size) do
    count += 1 if (a[i] == b[i])
  end
  count
end

for i in 0..(s.size - t.size) do
  tmp = hoge(s[i...(i+t.size)], t)
  if (tmp > max)
    max = tmp
  end
end

puts motosize - max