#K12471. Most Frequent Hashtag

    ID: 23698 Type: Default 1000ms 256MiB

Most Frequent Hashtag

Most Frequent Hashtag

Given a list of posts, each being a string, your task is to determine the most frequently occurring valid hashtag. A valid hashtag is defined as a '#' symbol immediately followed by one or more word characters (i.e. letters, digits, or underscores). In the event of a tie (i.e. multiple hashtags with the same maximum frequency), return the hashtag that appears earliest across the list of posts. If no valid hashtag exists in any post, output "None".

Note: The first line of input contains an integer (n) representing the number of posts. The following (n) lines each contain a post. The output should be printed to stdout.

inputFormat

The input is provided via stdin. The first line contains an integer (n) (the number of posts). The next (n) lines each contain a post (a string).

outputFormat

Output the most frequent valid hashtag to stdout. If no valid hashtag exists, output "None".## sample

5
#hello world this is a #test post
#hello again
#test the new feature
this is a normal sentence with no hashtags
another post with #hello
#hello