S = gets.chomp
T = gets.chomp

s_n = S.chars
t_n = T.chars
s_l = s_n.length
t_l = t_n.length
ans = t_l
(0..(s_l-t_l)).each do |i|
  count = 0
  (0..t_l-1).each do |j|
    count += 1 if s_n[i+j] != t_n[j]
  end
  ans = [ans, count].min
end

p ans