#C8758. Books by Author

    ID: 52775 Type: Default 1000ms 256MiB

Books by Author

Books by Author

You are given a list of books along with their authors. Each book is represented as a pair containing the book title and the author's name. Your task is to filter the list and return all book titles written by a specific author.

Formally, you are given an integer \(n\) (where \(n \ge 0\)) which represents the number of books. This is followed by \(n\) lines; each line contains a book title and an author's name separated by a comma. The final line of input is the name of the target author.

Your solution should output a JSON array (in string format) representing the list of book titles by the queried author. If no books are found by that author, output an empty JSON array [].

inputFormat

The input is read from standard input (stdin) in the following format:

  • The first line contains an integer \(n\), the number of books.
  • The next \(n\) lines each contain a book title and an author's name separated by a comma (",").
  • The last line contains the name of the author to be queried.

outputFormat

Print to standard output (stdout) a JSON array (as a string) containing all book titles written by the queried author. If no titles are found, print an empty array [].

## sample
5
To Kill a Mockingbird,Harper Lee
1984,George Orwell
Animal Farm,George Orwell
Pride and Prejudice,Jane Austen
The Great Gatsby,F. Scott Fitzgerald
George Orwell
["1984", "Animal Farm"]