#include <cctype> #include <iostream> #include <string> #include <ctype.h> #include <map> using namespace std; string& tranform(string& word) { for(auto& e : word) { if(isupper(e)) e = tolower(e); if(e == '.') word.pop_back(); } return word; } int main() { string word; map<string, int> countMap; while(cin >> word) { // 单词入map之前需要处理句号和单词转小写 countMap[tranform(word)]++; } for(auto& e : countMap) { cout << e.first << ":" << e.second << endl; } return 0; }