#C13187. Word Frequency Counter
Word Frequency Counter
Word Frequency Counter
You are given a string containing words separated by spaces. Your task is to count the frequency of each word and output the result in a JSON formatted dictionary. The keys in the dictionary must be the words and the values their corresponding counts. Note that words are case-sensitive (for example, "Hello" and "hello" are treated as different words).
For example, if the input is "apple apple orange banana banana banana", the output should be {"apple": 2, "orange": 1, "banana": 3}.
inputFormat
A single string is provided via stdin. The string may be empty and words are separated by spaces.
outputFormat
Print the frequency dictionary in JSON format to stdout. The dictionary must list keys (words) in the order of their first occurrence in the input.## sample
hello
{"hello": 1}