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 Neural Networks and document ranking to re-rank the web pages BERT models and the web - do they actually work for big content docs Page-rank and how to handle leaf nodes 2 web content
Google and the page-rank algorithm to search the web content BERT models and the web - do they actually work for big content docs
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue