题目描述:
1 #include <iostream>
2 #include <string>
3 #include <cctype>
4 #include <vector>
5 #include <map>
6 #include <algorithm>
7 using namespace std;
8
9 map<string,int> msi ;
10 vector<string> words ;
11 string re(string &s){
12 string a = s ;
13 for(int i=0;i<a.length();i++)
14 a[i] = tolower(a[i]) ;
15 sort(a.begin(),a.end()) ;
16 return a ;
17 }
18 int main(int argc, char *argv[])
19 {
20 string s ;
21 while(cin >> s){
22 if(s[0] == '#') break ;
23 words.push_back(s) ;
24 string r= re(s) ;
25 if(!msi.count(r)) msi[r] = 0 ;
26 msi[r] ++ ;
27 }
28 vector<string> a ;
29 for(int i=0;i<words.size();i++)
30 if(msi[re(words[i])] == 1) a.push_back(words[i]) ;
31 sort(a.begin(),a.end()) ;
32 for(int i=0;i<a.size() ;i++) cout << a[i] <<"
" ;
33 return 0;
34 }