S = gets.chomp!
T = gets.chomp!

min_count = Float::INFINITY
(0...(S.size)).each do |i|
  count = T.size
  if S[i...(S.size)].size >= T.size
    S[i...(S.size)].split('').zip(T.split('')).each do |s, t|
      if s == t
        count -= 1
      end
    end
  end

  if min_count > count
    min_count = count
  end
end

puts min_count
