Vocabulary

Jack and Jill were arguing about which one of them had the richest vocabulary. Because neither one of them gave up, Jill proposed a game to test Jack’s vocabulary: • Jill would write down a list of strings, each one of them called a challenge. • A challenge s in Jill’s list is solved by Jack if he could say a word w from his vocabulary, such that every letter occurs in w with at least the same multiplicity that occurs in s. Two different challenges may be not solved with the same word. Jack’s vocabulary is defined as the set of words he knows. Given a list of Jill’s challenges, Jack would like to know how many of them he can solve. Input There are several cases to solve. Each case begins with a line containing blank-separated numbers V and C: the former is the number of words in Jack’s vocabulary (1 ≤ V ≤ 500) and the latter is the number of challenges presented by Jill (1 ≤ C ≤ 500). Each one of the next V lines contains a word in Jack’s vocabulary. Then, each one of the next C lines contains a challenge made by Jill. Both, the words in Jack’s vocabulary and the challenges made by Jill, consist of 1 to 30 lowercase English letters (a. . .z). Jack’s vocabulary does not contain duplicate words. Output For each test case, print the maximum number of challenges that Jack can solve. Sample Input 11 icpc pic 43 sequoia march may tree ae aeiou acm Sample Output 1 2