# frozen_string_literal: true

s = gets.chomp
t = gets.chomp

max = 0
(0..(s.size - t.size)).each do |i|
  count = 0
  a = s[i..(i + t.size - 1)]
  (0..(t.size - 1)).each do |j|
    count += 1 if a[j] == t[j]
  end
  max = count if max < count
end
puts t.size - max
