s = gets.chomp
t = gets.chomp
sl = s.length
tl = t.length
min_count = tl
for offset in 0..(sl - tl) do
  count = 0
  for i in 0...tl do
    if s[i + offset] != t[i]
      count += 1
    end
  end
  min_count = count if min_count > count
end
puts min_count
