def count(sentence): words = sentence.split() total_words = len(words) for word in words: print(f"单词:{word},长度:{len(word)}") print(f"整个句子的总单词数:{total_words}") sentence = input("请输入一个句子:") count(sentence)