#C1000. GHCSC Lesson 5 Dictionary Exercise 3
GHCSC Lesson 5 Dictionary Exercise 3
Write a function count_words(text) that returns a dictionary where the keys are words in the string and the values are the number of times each word appears.
INPUT FORMAT
One line contains strings, each separated by a blank space.
OUTPUT FORMAT
For each string appeared, output the string and the number of time it appeares. The string should be outputed in the dictionary order.
SAMPLE
INPUT
apple banana apple orange banana apple
OUTPUT
apple 3
banana 2
orange 1