str = gets.chomp
base = gets.chomp

str_size = str.size
base_size = base.size

match_max = 0
(str_size - base_size + 1).times do |i|
  tmp_match_sum = 0
  base_size.times do |j|
    tmp_match_sum += 1 if str[i + j] == base[j]
  end
  match_max = [match_max, tmp_match_sum].max
end



puts base_size - match_max