|
||||||||||
URLTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 653 Accepted Submission(s): 205 Problem Description WHU ACM Team is working on a brand new web browser named "Whu-Super-Browser". You're in response for a powerful feature: recording the previous addresses. Moreover, when a string is inputted, the browser will display all the addresses start with it. The addresses shall be sorted by visited times, in descending order. This feature is very useful to users. Can you complete it? There're two kinds of operations: Visit [url_str] : visit a website with the URL: [url_str]. Display [str] : display all addresses start with [str] and sort them by visited times, in descending order. If two addresses have the same visited times, then sort them in the lexicographical order. Input The input consists of multiple test cases. The first line of input contains an integer T, which is the number of test cases. Each test case is on several lines. The first line of each test case consists of an integer N. Each of the following N lines consists of an operation, Visit or Display. [Technical Specification] T is an integer, and T <= 10. N is an integer, and 1 <= N <=100. There's NO blank line between test cases. [url_str] and [str] only contains lower case letters 'a' - 'z', '.', '/', ':'. The length of [url_str] and [str] is greater than 0 and won't exceed 100. Output For each test case, display addresses as required, each address on a separated line. Add a blank line after each 'Display' operation. Sample Input
Sample Output
Source | ||||||||||
|