input = readlines()
s = input.shift.chomp
t = input.shift.chomp

s_arr = s.split('')
t_arr = t.split('')

max_match = 0
s_arr.each_with_index do |chr, i|
  tmp = s[i, t_arr.length]
  next if tmp.length < t_arr.length
  match = 0
  tmp.split('').each_with_index do |c, i2|
    match += 1 if t_arr[i2] == c
  end
  max_match = match if max_match < match
end

puts t_arr.length - max_match
