写个字典程序,数句子中出现相同单词的次数.
Using a dictionary, create a program that counts the number of times a word appears in a sentence. You should use a key to represent the word; the value should be the word count. Your program should first prompt the user for a sentence. You can ask for the input and split the sentence into separate words using the following code:
text=raw_input("Enter a sentence:")
words=text.split()
The variable words will then contain a list of all the words in the sentence.