#include #include #include #include #include #include using namespace std; int main() { map words; int sum=0; ifstream infile("aaa.txt"); if(!infile) { cout <<"Can't find the input file aaa.txt"; return 1; } else { string tword; while(infile>>tword) { string word; for(string::const_iterator it=tword.begin();it!=tword.end();it++) { if(!ispunct(*it)) { word+=*it; } } if(word.size()!=0) { words[word]++; sum++; } } } map::iterator it=words.begin(); int max=0; for(;it!=words.end();++it) { if(it->second>max) max=it->second; } for(int i=max;i>=1;i--) { for(it=words.begin();it!=words.end();++it) { if(it->second==i) cout <<"Word: " <first <<" appears: " <second <<" times." <