Searching the docs
When searching through the class documents you want to find the title of the class that you would like to rehearse before the exam. You remember some words from the title but you’re not sure about the rest. To automate that process you decide to write a program that would do the search for you.
You will first input the number of documents covered in the class n
. The next n
lines will be the titles of those documents. Then, you’ll input the number of words you remember w
. The next w
lines will contain the w
words you remember from that title.
The program should output all the document titles that have all of the words you remember.
Note that you would like to do a case-insensitive search, so you’d want the search engine to ignore the uppercase-lowercase differences.
Input | Output |
---|---|
4 | Google and the page-rank algorithm to search the web content |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB