def sliding_window(text, stepSize, windowSize): for t in range(0, len(text), stepSize): yield text[t:t + windowSize] s = str(input()) m = int(input()) c = [str(input()) for i in range(m)] count = 0 for ci in c: for t in sliding_window(s, 1, len(ci)): if t == ci: count += 1 print(count)