input_s = gets.chomp.split("")
input_t = gets.chomp.split("")
s_length = input_s.length
t_length = input_t.length

margin = (s_length - t_length) + 1

nomatch_times = []	

margin.times do |index|
  nomatch = 0
  input_t.each do |t|
    if input_s[index] != t
      nomatch += 1
    end
    index += 1
  end
  nomatch_times << nomatch
end

puts nomatch_times.min