Author and Books Formatting
Given a structured list of books and their authors, format the information as specified.
Input:
The first line of input contains an integer ‘T' representing the number of test cases.
The first line of each test case contains one integer, ‘N’ denoting the number of authors.
The next N’ lines contain a stream of strings, where the first token is an integer ‘M’ denoting the number of books, the second token is the ‘NameOfAuthor’ and the other space-separated strings are the ‘Books’ written by the author.
Output:
For each test case, print the author names and their books as specified in the problem statement format.
Do not worry about indentation, as it is already handled. Focus on the correct sequence and labeling.
Example:
Input:
1
2
2 AuthorOne BookA BookB
1 AuthorTwo BookC
Output:
1. AuthorOne
A. BookA
B. BookB
2. AuthorTwo
A. BookC
Constraints:
- 1 ≤ T ≤ 10
- 1 ≤ N ≤ 1000
- 1 ≤ |S| ≤ 100
- 1 ≤ Number of books by each author ≤ 26
- Time limit: 1 sec
Note:
You do not need to print anything. It has already been handled. Just implement the provided function.
Be the first one to answer
Add answer anonymously...
Top Optum Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Optum Software Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app