S = gets.chomp
T = gets.chomp
l = S.size
m = T.size
min_cnt = m
0.upto(l) do |n|
    break if l - n < m
    cnt = 0
    0.upto(m) do |m|
        cnt += 1 if T[m] != S[n+m]
    end
    min_cnt = [min_cnt, cnt].min
end
puts min_cnt