#C13862. Word Frequency Analyzer
Word Frequency Analyzer
Word Frequency Analyzer
You are given a block of text from the standard input (stdin). Your task is to analyze the text and count the frequency of each unique word. In this problem, a word is defined as a consecutive sequence of alphanumeric characters. The analysis must be case-insensitive and all punctuation should be ignored.
The output should list each unique word along with its frequency. The words must be sorted primarily in descending order by their frequency, and if two words have the same frequency, they should be sorted in alphabetical order (ascending). Each output line should consist of the word followed by a single space and then its frequency.
Note: Words are converted to lowercase during processing. For example, "Apple", "apple", and "APPLE" are considered the same word.
The expected ordering is defined as follows:
$$\text{Sort by } (\text{frequency (desc)},\; \text{word (asc)}) $$inputFormat
The input is given via standard input (stdin) and consists of a block of text which may span multiple lines. The entire text should be processed as a whole.
outputFormat
Output to standard output (stdout) a list of words and their frequencies. Each line should contain a word followed by a space and its frequency, according to the sorting rules described above.
## sampleHello
hello 1