s = gets.chomp
t = gets.chomp
s_size = s.size
t_size = t.size
ans = 1000
(0..s_size - t_size).each do |from|
  change = 0
  t_size.times do |time|
    change += 1 if s[from + time] != t[time]
  end
  ans = change if ans > change
end
puts ans
