s, t = readlines.map(&:chomp)

kekka = t.size
schar = s.chars
tchar = t.chars

((s.size + 1) - t.size).times do |i|
  diff = 0
  tchar.each_with_index do |str, j|
	diff += 1 if str != schar[j+i]
  end
  kekka = [kekka, diff].min
end

p kekka