aaaa a abcd cb a abab
4
 0
 0

def get_unique_substrings(inputstr, uniqsubstrs):
    uniqsubstrs.add(inputstr)
    
    i,j = 0,0
    #u[j]=inputstr
    length = len(inputstr)
    while i < length:
        substr1 = inputstr[i:]
        j  = len(substr1)
        k = j
        while k >= 1:
            substr2 = substr1[:k]
            #print(substr2)
            if substr2 not in uniqsubstrs:
                uniqsubstrs.add(substr2)
                #j+=1
                #u[j]=substr2
                
            k -= 1
        i +=1
s1,s2=raw_input().split()        
allunique_substr = set(s1)
get_unique_substrings(s1, allunique_substr)
c=0
s=list(allunique_substr)
#print s
for i in range(len(s)):
	if s2 in s[i]:
		c+=1
		 
print c