s=input() n=int(input()) c=0 for _ in [0]*n: t=input() if t not in s: continue r=s while r.find(t)>-1: c+=1 r=r[r.find(t)+1:] print(c)