S = input() M = int(input()) C = [] for i in range(M): C.append(input()) def search(C, S): count = 0 while S.find(C) != -1: S = S[S.find(C)+1:] count += 1 return count count = 0 for i in range(M): count += search(C[i], S) print(count)