Now that the archeologists have found books on the lost continent of Atlantis they are looking to try and understand more about the people through its literature. To do this, they want to know what words were most commonly used and which authors used these words in an effort to grasp the Atlantean culture a bit better.
First you will be told how many collections of documents you are working with, N. Each description of a collection begins with the number of documents, D. The next number is the number of most frequent words the archeologists want to know for that document. Each of the previous is on one line. See input for a line by line description.
A list of the author(s) follows the next line, the one with the number of the most frequent words to find,representing the authors of the first document where each author's name is followed by a comma, including the last author. On the line(s) following the names of the authors of this document will be the document text. The document text will end when a the straight bar character ('|') is found.
There will be D documents before the next collection starts. You will then need to print out which words were most common, in this collection, and which authors used them. If there is a tie on the most frequent words, output them in alphabetical order.
ERRATA updated with clarrification of what a word is
A word is any sequence of uninterrupted alphabetic characters (i.e. [a-z][A-Z]). Anything that is not an alphabetic character terminates a word. A word begins with an alphabetic character no matter what comes before it.
These words should be ignored and not counted: "a", "the", "my", "to" .
For the collection there will be D documents, each containing one author line and a set of text lines. Then if N is > 1 the next collection starts with "D", the number of documents in the collection. Please see the sample input below.
egins with an alphabetic character no matter what comes before it.The output will be formatted as followed:
2 3 2 Dio Brando, Jonathan Joestar, The stone mask caused Dio to turn into a vampire. Jonathan became a ripple warrior and destroyed stone mask. Dio was then put into a stone casket, sealed away for 150 Dio Brando, My father Darius abused me and my mother for years, so I poisoned him and killed him. I used the stone mask to transcend humanity and become a vampire.| Antonio Zeppeli, I became a vampire hunter because a vampire killed my fellow shipmen. Death to the vampire that killed my family.| 4 3 Isaac Traxler, The world of Cyberpunk is a good illustration of where America's youth is headed for. constant information bombardment. Each youth has at least a smart phone and a constant need to check for texts, missed calls, Twitter, etc. This need leads to texting when Ken Don, The first line of output should start with the word "Case" followed by the number representing which collection you are working on. The next F lines are the words using that word, and at the end of the author list a closing square bracket (']'). Each line above is printed in order of the frequency of the words from the most frequent word first down to the least frequent of the F words requested. In the example below 'F' is 2 so you will have two lines in the first collection. If there is words with the same frequency you will print them in alphabetic order. Isaac Traxler, Kathy Traxler, There is only one dumb question. This is the question that you don't ask. You want to, you are pretty sure that the answer is important but you just can't ask. Whether you are a student, and employee or an employer if you don't ask that question you will never know the answer and the answer can change how your whole world is shaped. This answer could connect you and change the way the person you are talking to views their world. So ask the question! Isaac Traxler, Ken Don, Programming Contest is an excellent way to learn the skills required for the "real world" of programmers, team leads, architects and plain old problem solvers. Programming contest is on place where you actually have to work on a team. One computer, 8 problems, three contestants and you have a scheduling nightmare, a time time management skill and many others.Note: lines broken for readability only!
Case 1 vampire : [ Antonio Zeppeli, Jonathan Joestar, Dio Brando] stone : [ Jonathan Joestar, Dio Brando] Case 2 you : [ Isaac Traxler, Kathy Traxler] ask : [ Isaac Traxler, Kathy Traxler] words : [ Ken Don]