#C123. Article Keyword Search
Article Keyword Search
Article Keyword Search
You are given a list of article titles and a query string containing one or more keywords separated by spaces. Your task is to output all articles that contain all the keywords in the query. The matching should be case-insensitive and the order of output should be the same as the input.
Formally, if we denote by A the set of article titles and by Q the query which is split into keywords \(q_1, q_2, \ldots, q_k\), then you need to output each article \(a \in A\) such that for all \(i = 1,2,\ldots,k\), the lowercase of \(q_i\) is a substring of the lowercase of \(a\).
inputFormat
The input is read from stdin and has the following format:
N article_1 article_2 ... article_N query
Where:
N
is an integer representing the number of articles.- The next
N
lines each contain an article title. - The last line contains the query string with one or more space-separated keywords.
outputFormat
The output should be written to stdout. For each article that contains all of the keywords (case-insensitive), output the original article on a new line. If no article matches, output nothing.
## sample6
Python programming language
Introduction to the Python programming
JavaScript and web development
Learning Python and machine learning
Introduction to JavaScript
Data science and Python
Python programming
Python programming language
Introduction to the Python programming
</p>