405236: GYM101853 K Citations
Description
A citation is a reference to a published or unpublished source. This source can be a book or an article. For example, if you are writing a new article discusses the Advanced Encryption Standard (AES) you may add a reference to the AES Proposal: Rijndael, which contains the detailed description of the algorithm from the authors. Each article or book may contain multiple citations that are provided after the end of the content.
One of the most exhausting things is to prepare the format of the citations because each journal has different requirements for the citations section. In this problem, you will help all the researchers in the world by providing an automated method to prepare the citations for them.
Usually, the citations are placed in a file named BibTeX file. This file consists of a list of citations, such that each citation is represented as follow:
Each entry in the BibTeX file is consisting of 8 sections, which are: author, title, journal, year, volume, number, pages, and publisher.
To generate a human-readable format of the citations, the BibTeX file is compiled and the information it contains will be used to show the human-readable format of the citations in following structure:
Thus, the above citation will be shown as follow:
An. D, Da. F, Ne. R, Br. S, Pa. M. Evaluating the power consumption of wireless sensor network applications using models. Sensors. 2013;13(3):3473-3500.
Notice that all the information provided in the BibTeX file was used as it is given in the file except for the author section. Each author name will be converted so that the first two letters of author’s first name and the first letter of the author’s last name will be taken and concatenated with a dot and space in between (i.e. ". "), as shown in the example above.
You are given a BibTeX file contains n citations, and your task is to convert them to the human-readable format. Can you?
InputThe first line contains an integer T (1 ≤ T ≤ 100), in which T is the number of test cases.
The first line of each test case contains an integer n (1 ≤ n ≤ 1000), in which n is the number of citations in the BibTeX file. Then n citations follow, giving a BibTeX file. The format of each citation will be as the picture shown in the statement. Please check the sample input for more clarification.
It is guaranteed that no section will be empty and no white spaces will exist outside the curly braces of each section (i.e. {}), and each section will be on a separate line. Also, volume, number, and year sections will contain only integer values. Moreover, the format of the pages section is always "x-y", in which x and y are the starting and ending pages, respectively. Both x and y are integer values. Finally, each author's name consists of two space-separated names; the first and the last names. Both names are non-empty strings consisting of English letters such that the first letter of each name is uppercase and the remaining letters are lowercase. The length of author's first name is at least 2 letters. The author's section may contain multiple authors, these authors will be separated by a comma and space (i.e. ", ").
Sections inside each citation are not given in a specific order. The length of each section’s line is at most 120.
OutputFor each citation, print a single line containing the human-readable format. Each citation must be printed in one line only and without any extra spaces.
ExampleInput1Output
2
@article{
title={Testing},
author={Ahmed Salem},
journal={Planta},
volume={10},
number={7},
pages={20-30},
year={2016},
publisher={Springer}
}
@article{
journal={Proofs from THE BOOK},
pages={55-58},
volume={9},
number={11},
author={Ahmed Salem, Ali Ramadan},
title={WSN},
year={2010},
publisher={Springer}
}
Ah. S. Testing. Planta. 2016;10(7):20-30.
Ah. S, Al. R. WSN. Proofs from THE BOOK. 2010;9(11):55-58.