#K56712. Word Frequency Counter
Word Frequency Counter
Word Frequency Counter
Given a document as input, count the frequency of each word. A word is defined as a consecutive sequence of alphabetical characters (both uppercase and lowercase). The counting is case-insensitive. Output the frequency for each unique word in lexicographical order. Each output line should contain a word followed by a space and its corresponding frequency. (\text{Words are extracted using the regular expression }[a-zA-Z]+).
inputFormat
A single line of text representing the document.
outputFormat
Output each unique word and its frequency in alphabetical order. Each line should contain the word and the frequency separated by a space.## sample
Hello
hello 1
</p>