使用字典实现以下程序:
用户首先输入一个英文段落,其中可能包含4种字符:字母、数字、空格、英文逗号和英文句号。
用户再次输入一个英文单词,输出:
段落一共有多少个单词
不同的单词有多少个
用户输入的单词出现多少次
计算并打印英文段落中这个单词的出现次数,不用区分大小写。
例如:
用户首先输入以下段落:
Python is an interpreted, interactive, object oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. It supports multiple programming paradigms beyond object oriented programming, such as procedural and functional programming. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C plus plus. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants including Linux and macOS, and on Windows.
用户再输入: python
输出:一共有103个单词,其中有72个不同的单词,python出现了3次。