def string_diff(a,b)
  num = 0
  a.size.times do |i|
    num += 1 if a[i] != b[i]
  end
  num
end

s = gets.chomp
t = gets.chomp
if s.include?(t)
  puts '0'
  exit
end
ans = t.size
(0..(s.size-t.size)).each do |i|
  num = string_diff(s[i..i+t.size-1], t)
  ans = [ans, num].min
end
puts ans