A group of N people are debating and unable to decide whom to believe. Therefore, they devised a method: collectively determining a keyword. Whoever mentions the keyword the most in their sentences will be considered the most valuable.
Given N, a keyword, N people, and N sentences, please output the person to be trusted along with the sentence they uttered. In case the most valuable sentence isn't unique, the first person who speaks it will be considered as delivering the most valuable statement.
Note that a keyword will only be counted when it appears as a single word. For example, if the keyword is 'ac', instances like 'ac' within the word 'teach' won't be considered. However, if 'ac' is preceded or followed by punctuation marks, those instances will be counted. Also, the keyword is case-insensitive, which means 'Ac', 'AC', 'ac', 'aC' will all be counted.
Hints:
1. Use strtok(). (https://cplusplus.com/reference/cstring/strtok/)
2. Use fgets(). (https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fgets-fgetws?view=msvc-170)
The first line contains an integer N and a keyword.
The following N line would be in this format:
<name>:<sentence>
len(keyword) <= 1000, N <= 1000, len(namei + sentencei) <= 100000
keyword is only composed by english letters.
<name> is composed by english letters and spaces.
<sentence> is composed by english letters, spaces, and ",.?!" these four punctuation marks.
If the k-th person delivered the most valuable sentence, please output like this:
<namek>: <sentencek>
There is a space after ':' and a '\n' in the end.