提示: 欢迎访问OurACM平台。
Problem 1663 Who is the murderer

Accept: 187    Submit: 620
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

What a terrible thing. There is a case of murder in city W. Detector oaiei is asked to investigate the murder case.
Oaiei is so clever that he has found some DNA segment in the crime scene. As we all know, DNA only consists of four kinds of genes “A”,”C”,”G”and ”T”.
Fortunately, oaiei has caught some suspects. So oaiei thinked he can find the murderer according to their DNA segments.
Now, your task is to help oaiei find the murderer.

Input

There are multiple test cases. For each case, the first line are two integers N(1<=N<=100) and M(1<=M<=100), indicating the number of DNA segments found in the crime scene and the number of DNA segments given from the suspects.
The following N lines, each line contains a DNA segment, which is found in the crime scene. Then following M lines, each line contains a DNA segment, which is given from the suspects. Each DNA segment only contains character of “A”,”C”,”G”and ”T”.
We assume that the length of each DNA segments found in the crime scene will not exceed 100 and the length of each DNA segments given from the suspects will not exceed 100000.
If the DNA segment of a suspect has some DNA segments found in the crime scene, we can say the suspect must be a murderer.

Output

For each test case, output an integer, indicating the number of murderer.

Sample Input

4 4 ACTGG ACT TTCAG CCTTAGT A ACT ACTT ACCTTAGTGG

Sample Output

3

Source

FOJ月赛-2008年10月

Submit  Back  Status  Discuss