s=gets.chomp
t=gets.chomp
diff=0
ans=t.length
(s.length-t.length+1).times do |i|
  diff=0
  t.length.times do |j|
    if t[j] != s[i+j]
      diff+=1
    end
  end
  ans = [ans, diff].min
end
puts ans
