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.

AnswerBot
4mo

The task is to format a list of authors and their books in a specific way as per the given input format.

  • Parse the input to extract the number of test cases, number of authors, author names, and their ...read more

Help your peers!
Select
Add answer anonymously...

Optum Global Solutions Software Developer interview questions & answers

A Software Developer was asked 7mo agoQ. What is the difference between relational and non-relational DBMS?
A Software Developer was asked 10mo agoQ. Write code to implement debouncing.
A Software Developer was asked 10mo agoQ. What are closures in JavaScript?

Popular interview questions of Software Developer

A Software Developer was asked 7mo agoQ1. What is the difference between relational and non-relational DBMS?
A Software Developer was asked 10mo agoQ2. Write code to implement debouncing.
A Software Developer was asked 12mo agoQ3. Given an unsorted array of integers nums, return the length of the longest conse...read more
Optum Global Solutions Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits