s = gets.chomp
t = gets.chomp

array = []
(s.length - t.length + 1).times do |i|
#   puts "#{s[i..t.length - 1 + i]} #{t}"
  cnt = 0
  t.length.times do |j|
    # puts "#{s[i..t.length - 1 + i][j]} #{t[j]}"
    if s[i..t.length - 1 + i][j] != t[j]
      cnt += 1
    end
  end
  array << cnt
end

puts array.min