s = gets.chomp
t = gets.chomp

n = s.size
m = t.size

min = 100000
m.times do |j|
	i = 0
	n.times do |i|
		count = 0
		next if i < j or n - i < m
		m.times do |k|
			count += 1 if s[i - j + k] == t[k]
		end
		min = [min, m - count].min
		i += 1
	end
end

p min