1 #coding = utf-8 2 import sys 3 4 def Sub_string(a,b): 5 c=[0]*len(b) 6 for i in range(len(a)): 7 for j in range(len(b)): 8 if str(a[i]).find(str(b[j]))!=-1: 9 c[j] = c[j] + 1 10 for k in c: 11 print(k) 12 13 if __name__=='__main__': 14 N=int(sys.stdin.readline().strip()) 15 a=list() 16 b=list() 17 for i in range(N): 18 a.append(input()) 19 M = int(sys.stdin.readline().strip()) 20 for i in range(M): 21 b.append(input()) 22 Sub_string(a, b)
输入:
3
aaa
aaa
baa
2
aa
ba
输出:
3
1