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

ans = t.length
for i in 0..(s.length-t.length)
  cnt = 0
  for j in 0..(t.length-1)
    cnt += 1 if s[i+j] != t[j]
  end
  ans = [ans,cnt].min
end
puts ans