#C172. Popular Hashtags Finder
Popular Hashtags Finder
Popular Hashtags Finder
You are given a list of social media posts and two integers ( n ) and ( k ). Your task is to identify all hashtags that appear more than ( k ) times in the first ( n ) posts. A hashtag is defined as a word that starts with the character '#' followed by one or more alphanumeric characters or underscores. The solution should read the input from standard input (stdin) and output the popular hashtags to standard output (stdout) in lexicographical order, separated by a space. If no popular hashtag exists, output an empty line.
inputFormat
The first line contains three integers ( P ), ( n ), and ( k ), where ( P ) is the total number of posts, ( n ) is the number of posts to consider (( 1 \leq n \leq P )), and ( k ) is the threshold. Each of the following ( P ) lines contains a social media post.
outputFormat
Output a single line containing all popular hashtags (those appearing more than ( k ) times in the first ( n ) posts) in lexicographical order separated by a space. If there are no popular hashtags, output an empty line.## sample
6 5 2
I love #python and #coding
Learning #python is fun
Follow for more #coding challenges
#python #python #java
#coding is my passion
#java is also interesting
#coding #python
</p>