s = gets.chomp
t = gets.chomp

n = s.length - t.length + 1
m = t.length

min_count = m
n.times do |i|
  count = 0
  m.times do |j|
    count += 1 if s[i + j] != t[j]
  end
  min_count = count if min_count > count
end

puts min_count
