#C12488. Count Unique Words

    ID: 41920 Type: Default 1000ms 256MiB

Count Unique Words

Count Unique Words

Given a text string, your task is to count the frequency of each unique word present in it. Words are defined as sequences of alphanumeric characters, and they are case-insensitive. All punctuation should be ignored. The output must be a JSON object (as a string) where each key is a word and its value is the number of occurrences of that word. The keys in the output JSON object should be sorted in lexicographical (alphabetical) order.

Example:

Input: Hello world! Hello, how are you? Are you learning Python? Learning is fun!
Output: {"are":2,"fun":1,"hello":2,"how":1,"is":1,"learning":2,"python":1,"world":1,"you":2}

inputFormat

The input is provided via standard input (stdin) as a single line of text.

outputFormat

The output should be printed to standard output (stdout) as a JSON object string. The JSON object maps each unique word (in lowercase) to its count. The keys in the JSON object must be in alphabetical order.

## sample
Hello
{"hello":1}