#C14877. Book Titles Keyword Search

    ID: 44574 Type: Default 1000ms 256MiB

Book Titles Keyword Search

You are given a list of book titles and a list of keywords. Your task is to find all the book titles that contain any of the given keywords as a substring (case-insensitive). If either the list of book titles or the list of keywords is empty, or if no titles match, output No matches found.

The search is performed in a case-insensitive manner, meaning that for any title, if any keyword appears in it (regardless of letter case), then that title is considered a match and should be included in the result in the same order as the input.

If there is at least one matching title, print each matching title on a separate line. Otherwise, print No matches found.

Note: For any formulas, use LaTeX formatting (e.g. $\text{formula}$).

inputFormat

The input is given via stdin and has the following format:

  1. An integer n denoting the number of book titles.
  2. Followed by n lines, each containing a book title.
  3. An integer m denoting the number of keywords.
  4. Followed by m lines, each containing a keyword.

outputFormat

If there is at least one matching title, output each matching title on a separate line in the order they appear in the input. If no title matches the keywords or if either list is empty, print No matches found.

## sample
4
To Kill a Mockingbird
Pride and Prejudice
The Great Gatsby
The Catcher in the Rye
3
pride
great
moby
Pride and Prejudice

The Great Gatsby

</p>