s = gets.chomp.split('')
t = gets.chomp.split('')

s_l = s.length
t_l = t.length
max = s_l - t_l - 1 -1
min_cnt = t.length

(0..max).each do |i|
  cnt = 0
  s[i..i + t_l - 1].each_with_index do |ele,  i|
    cnt += 1 unless ele == t[i]
  end
  min_cnt = cnt if cnt < min_cnt
end

puts min_cnt
