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