# frozen_string_literal: true

s = gets.chomp
T = gets.chomp

ans = T.size
(0..(s.size - T.size)).each do |s_start|
  diff = 0
  (0..(T.size - 1)).each do |t_start|
    diff += 1 if T[t_start] != s[s_start + t_start]
  end
  ans = [ans, diff].min
end

puts ans
