#C8125. Keyword Engagement Analysis
Keyword Engagement Analysis
Keyword Engagement Analysis
Your task is to compute the keyword engagement. Given a list of user posts and a list of keywords, count for each keyword the number of posts that contain that keyword at least once.
Formally, you are given an integer (N) denoting the number of posts, followed by (N) lines each representing a post. Then, an integer (M) is provided followed by (M) lines each representing a keyword. For each keyword, determine how many posts contain that keyword as a substring. Output the result as (M) space-separated integers on one line.
inputFormat
The first line contains an integer (N) denoting the number of posts. Each of the next (N) lines contains a user post (which can include spaces). The following line contains an integer (M) representing the number of keywords. Each of the following (M) lines contains a keyword.
outputFormat
Output (M) integers in one line separated by a space, where the (i^{th}) integer is the number of posts that contain the (i^{th}) keyword. If there are no keywords (i.e. when (M = 0)), output an empty line.## sample
3
hello world
this is a test post
keyword analysis is important
2
hello
test
1 1
</p>