Lanrax
One day, the people in the VCN Research Center wrote a paper, but VinceBlack did not want to use any existing reference format. Therefore, he came up with a new reference format called LANRAX. Now he wishes you to write a LANRAX format generator.
We describe the LANRAX Reference Format in the way of strings and optional strings. A string is represented as {StringName}, and it can be regarded as a string variable. Also, a string can be directly expressed by a combination of some strings, like <{String1}: {String2}, {String3}>, which means string1 + ": " + string2 + ", " + string3 where + is string concatenation. An optional string is in the format [content] or ~[content] or [content]~, and it outputs its content only when all of its neighbor strings (the front one and back one) without ~ on its side are not null. That means, for [], it demands both the front one and back one to be not null for content output. For ~[], it demands the back one to be not null to output, and the front one should be not null for []~. A string with zero length is null.
For example:
{NAME1} = "YEE", {NAME2} = "172", {NAME3} = null, {NAME4} = "is here"
{NAME1}[-]{NAME2} = "YEE-172"
{NAME1}[-]{NAME3} = "YEE"
{NAME1}[-]~{NAME3} = "YEE-"
{NAME3}[-]~{NAME2} = "172"
<Mr. {NAME1}[-]{NAME2}>[ ]{NAME4} = "Mr. YEE-172 is here"
<{NAME3}[-]{NAME3}>[ ]{NAME4} = "is here"
{NAME1}[-]{NAME3}[+]{NAME4} = "YEEis here" // Please notice that only the nearest neighbor one string could affect the output of [].
For LANRAX, the final output should be {LANRAX} , which equals to<@ {AUTHOR}; {PUBLISHER}; {TITLE}; {CITATION}; {TIME}.>.
Please read the following rules really really carefully! Any different character (including a space) between your answer and the true answer will cause a wrong answer.
AUTHOR
• There can be multiple authors. The author names are {Author1}, {Author2}, ....., {Author[x]}, [x] is the number of the authors.
– The name of author should be presented in this format {Initials}[ ]{Author[x]FamilyName}. The {Initials} is the combination of first letters of the words in the {Author[x]FirstName} with a dot behind, and they are separated by a space. For example, if the family name is Black and the first name is Vince, the result should be V. Black. If the first name is William Jafferson and the family name is Clinton, the result should be W. J. Clinton.
• If there is no author, {AUTHOR} is null.
• If there is one author, {AUTHOR} should be {Author1}.
• If there are two authors, {AUTHOR} should be {Author1} and {Author2}
• If there are three to five authors, {AUTHOR} should be like {Author1}, {Author2}, {Author3} and {Author4} (Similar format for 3 and 5 authors).
• If there are more than five authors, {AUTHOR} should be {Author1} et al.
• If there is any word in {Author[x]FamilyName} and Author[x]FirstName starting from lower letter, convert it to upper letter.
PUBLISHER
• The {PUBLISHER} should be <<{City}[, ]{Province}>[, ]{Country}>[: ]{Publisher}.
• For example:
{City} = "Shenzhen", {Province} = "Guangdong", {Country} = "China", {Publisher} = "SUSTech"
{PUBLISHER} = "Shenzhen, Guangdong, China: SUSTech"
Another example:
{City} = null, {Province} = null, {Country} = null, {Publisher} = "Moon Station"
{PUBLISHER} = "Moon Station"
TITLE
• The {TITLE} should be ~["]{Title}["]~.
CITATION
• If {Type} = "BOOK", {CITATION} should be
<~[From ]{BookName}[~[, ]{Pages}]~>[~[ written by ]{BookAuthor}]~.
The string {Pages} = <~[page ]{PageNumbers}>, and {PageNumbers}derives from an array of integers in {PageNumberArray} which are the page numbers included. If there is only one page in {PageNumberArray}, then {PageNumbers} is equal to that page number. If there are multiple page numbers in {PageNumberArray}, {PageNumbers} should be all page numbers in increasing order separated by a semicolon and a space, and the last one should be separated by and (similar with authors). The continuous pages (more than 1 page) should be combined into a range, which is in the format of start-end.
– Example 1:
• Page numbers are [1,2,4,5,6,9,8,10,15].
• {Pages} = "page 1-2, 4-6, 8-10 and 15".
– Example 2:
• Page number is [4, 6]
• {Pages} = "page 4 and 6" .
– Example 3:
• Page number is [1,2,3]
• {Pages} = "page 1-3".
• If {Type} = "CONFERENCE", {CITATION} should be <~[In ]{ConferenceName}>[~[ held in ]{ConferencePlace}]~.
• If {Type} = "ONLINE", {CITATION} should be
<~[Accessed online from ]{WebsiteName}>[~[, link:]{WebHttpLink}]~.
• Please notice that {BookAuthor} is not represented in the rule of {Author}, but just as the raw input text.
TIME
• {TIME} = <~[{Date}[ ]~]{MonthAbbr}>[ ]{Year}, where the {MonthAbbr} is converted from {Month} through the following table.
{Month} |
{MonthAbbr} |
1 |
Jan. |
2 |
Feb. |
3 |
Mar. |
4 |
Apr. |
5 |
May |
6 |
Jun. |
7 |
Jul. |
8 |
Aug. |
9 |
Sep. |
10 |
Oct. |
11 |
Nov. |
12 |
Dec. |