#C3467. Word Count

    ID: 46897 Type: Default 1000ms 256MiB

Word Count

Word Count

Given a string of text, count the frequency of each unique word, ignoring case differences. A word is defined as a sequence of non-space characters separated by whitespace. The output should be a JSON-formatted object in which each key is a unique word (in lowercase) and the corresponding value is its frequency. The keys in the output must be sorted in lexicographical order.

For example, if the input is "Hello hello world", the output should be {"hello":2,"world":1}.

The solution should read the input from standard input (stdin) and write the result to standard output (stdout).

inputFormat

A single line of text containing words separated by whitespace. Words may include upper and lowercase letters.

outputFormat

A JSON-formatted object (without extra whitespace) where the keys are the unique words in lowercase (sorted in lexicographical order) and the values are the corresponding counts.## sample

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