This page is still under construction.

Parts of this page are still being built. What you see may change.

String Set

Time limit2sMemory limit1536 MB

Summary
Count how many of M query strings appear in a given set S of N strings.
Level

Easy2 of 10

Topics
Hash map
Solved
No attempts yet

Problem

You are given a set SS of NN strings.

Write a program that counts how many of the MM given strings are contained in the set SS.

Input

The first line contains the numbers of strings NN and MM (1≤N≤10,0001 \le N \le 10{,}000, 1≤M≤10,0001 \le M \le 10{,}000).

Each of the next NN lines contains a string in the set SS.

Each of the following MM lines contains a string to check.

Every string in the input consists only of lowercase English letters, and its length is at most 500. No string appears more than once in the set SS.

Output

Print on the first line how many of the MM strings are contained in the set SS.

Examples1

  1. Example 1

    Input
    5 11
    onlinejudgesystem
    sunlight
    codeplus
    sundaycoding
    codingsh
    online
    codeplus
    codeminus
    sunlight
    sunlit
    sundaycoding
    codingsh
    codinghs
    sondaycoding
    sunrise
    icerink
    
    Expected output
    4