#K91592. Word Frequency Counter

    ID: 38009 Type: Default 1000ms 256MiB

Word Frequency Counter

Word Frequency Counter

Given a text input, count the frequency of each word. The words are separated by spaces. Your task is to output a dictionary where the keys (words) are listed in ascending lexicographical order and the values represent their frequencies.

Please read the input from standard input (stdin) and print the result to standard output (stdout). If the input text is empty, output an empty dictionary: {}.

Note: The dictionary should be formatted as in Python with keys in single quotes. For example, for the input "this is a test this is only a test", the correct output is:

{'a': 2, 'is': 2, 'only': 1, 'test': 2, 'this': 2}

inputFormat

A single line string containing words separated by one or more spaces. The string may be empty.

outputFormat

A dictionary represented as a string in the format: {'word1': count1, 'word2': count2, ...} with the keys sorted lexicographically in ascending order.## sample

this is a test this is only a test
{'a': 2, 'is': 2, 'only': 1, 'test': 2, 'this': 2}