#C14976. Word Frequency Counter

    ID: 44684 Type: Default 1000ms 256MiB

Word Frequency Counter

Word Frequency Counter

Your task is to count the frequency of each word in a given input text. The input will be a single line that may contain letters, punctuation, and spaces. You need to ignore punctuation and capitalization. The output should be a JSON object that maps each word (in lowercase) to its frequency, with the keys sorted in alphabetical order.

For example, if the input is "Hello world! Hello, programming world.", then after ignoring punctuation and case, the words are "hello", "world", "hello", "programming", "world". The correct output is:

{"hello":2,"programming":1,"world":2}

inputFormat

The input consists of a single line of text read from stdin. This line may include letters, punctuation marks, and spaces.

outputFormat

Print to stdout a JSON object representing the word frequency map. The keys (words) must appear in alphabetical order.## sample

Hello world! Hello, programming world.
{"hello":2,"programming":1,"world":2}