#K1151. Word Frequency Counter

    ID: 23484 Type: Default 1000ms 256MiB

Word Frequency Counter

Word Frequency Counter

You are given a string that may contain letters, numbers, spaces, and punctuation. Your task is to compute the frequency of each unique word in the string. A word is defined as a sequence of characters separated by spaces. Before counting, convert all characters to lowercase and remove any punctuation. For instance, the input Hello world hello should produce the output {'hello': 2, 'world': 1}.

Note: Punctuation is defined as any character in the set \(\texttt{!"#$%&'()*+,-./:;?@[\\]^_`{|}~}\). The final output must be printed to standard output in the format of a dictionary with keys sorted in alphabetical order. Use single quotes for keys.

Example:

Input:
Hello world hello

Output: {'hello': 2, 'world': 1}

</p>

inputFormat

The input consists of a single line of text provided via standard input.

outputFormat

Print a single line to standard output: a dictionary representing the count of each word found in the input. The dictionary must have its keys (words) sorted in alphabetical order and be in the format:

{'word1': count1, 'word2': count2, ...}
## sample
hello
{'hello': 1}