Problem X
Trending Topic
Imagine you are in the hiring process for a company whose principal activity is the analysis of information in the Web. One of the tests consists in writing a program for maintaining up to date a set of trending topics. You will be hired depending on the efficiency of your solution.
They provide you with text from the most active blogs. The
text is organised daily and you have to provide the sorted list
of the
Input
Each input file contains one test case. The text
corresponding to a day is delimited by tag
<text>. Queries of top
Notes:
-
All words are composed only of lowercase letters of size at most
. -
The maximum number of different words that can appear is
. -
The maximum number of words per day is
. -
Words of length less than four characters are considered of no interest.
-
The number of days will be at most
. -
Output
The list of
Sample Input 1 | Sample Output 1 |
---|---|
<text> imagine you are in the hiring process of a company whose main business is analyzing the information that appears in the web </text> <text> a simple test consists in writing a program for maintaining up to date a set of trending topics </text> <text> you will be hired depending on the efficiency of your solution </text> <top 5 /> <text> they provide you with a file containing the text corresponding to a highly active blog </text> <text> the text is organized daily and you have to provide the sorted list of the n most frequent words during last week when asked </text> <text> each input file contains one test case the text corresponding to a day is delimited by tag text </text> <text> the query of top n words can appear between texts corresponding to two different days </text> <top 3 /> <text> blah blah blah blah blah blah blah blah blah please please please </text> <top 3 /> |
<top 5> analyzing 1 appears 1 business 1 company 1 consists 1 date 1 depending 1 efficiency 1 hired 1 hiring 1 imagine 1 information 1 main 1 maintaining 1 process 1 program 1 simple 1 solution 1 test 1 that 1 topics 1 trending 1 whose 1 will 1 writing 1 your 1 </top> <top 3> text 4 corresponding 3 file 2 provide 2 test 2 words 2 </top> <top 3> blah 9 text 4 corresponding 3 please 3 </top> |