h = {}
(?a..?z).each {|c| h[c] = h.size}
(?A..?Z).each {|c| h[c] = h.size}

s = gets.chomp

a = [0] * 52
s.each_char.with_index do |c, i|
    a[h[c]] |=  1 << i
end

t = gets.chomp
b = [0] * 52
t.each_char.with_index do |c, i|
    b[h[c]] |=  1 << i
end

mask = (1 << t.size) - 1

count = 0
(s.size - t.size + 1).times do
    k = 0
    (0..52).each do |i|
        x = (a[i] & mask) ^ b[i]
        next if x == 0
        if x & (x - 1) == 0
            k += 1
            if k > 2
                k = 0
                break
            end
        else
            k = 0
            break
        end
    end
    a.map! {|x| x >> 1}
    count += k / 2
end

p count