s = gets.chomp
t = gets.chomp
ss = s.size
ts = t.size
ans = Float::INFINITY

0.upto(ss - ts) do |i|
  count = 0
  s[i, ts].each_char.with_index { |c, idx| count += 1 if c != t[idx] }
  ans = [ans, count].min
end

puts ans