S = gets.chomp.to_s
T = gets.chomp.to_s

sl = S.length
st = T.length
ans = 1000

if S.include?(T)
  ans = 0
else
  (0..sl-st).each do |i|
    count = 0
    (0...st).each do |j|
      if S[j+i] != T[j]
        count += 1
      end
    end
    if count < ans
      ans = count
    end
  end
end

puts ans