#C13624. Word Frequency Counter
Word Frequency Counter
Word Frequency Counter
In this problem, you are given a list of sentences. Your task is to count the number of occurrences of each word across all the sentences. Words are defined as contiguous sequences of alphanumeric characters. The counting should be case-insensitive (i.e., 'Hello' and 'hello' are considered the same word), and all punctuation should be ignored. The final output should display each unique word along with its frequency, sorted in alphabetical order.
Note: When processing the input, assume that the first line contains an integer (n) indicating the number of sentences that follow. Then, (n) lines follow, each being a sentence. For example, a sentence like "Hello, world!" should be treated as the words "hello" and "world".
inputFormat
The input is read from standard input (stdin). The first line contains an integer (n) ((0 \le n \le 10^5)), representing the number of sentences. Each of the next (n) lines contains a sentence. Each sentence may include letters, digits, spaces, and punctuation.
outputFormat
Output to standard output (stdout) each unique word and its count in a separate line, with the word and count separated by a space. The words must be printed in alphabetical order.## sample
1
Hello world
hello 1
world 1
</p>