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

result = t.length
s.each_cons(t.length) do |arr|
  tmp = t.length
  (0..t.length-1).each do |i|
    tmp -= 1 if arr[i] == t[i]
  end
  result = tmp if tmp < result
end

puts result
