-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestA.cpp
More file actions
39 lines (33 loc) · 753 Bytes
/
Copy pathtestA.cpp
File metadata and controls
39 lines (33 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <map>
#include <algorithm>
using namespace std;
map<string,int>cnt;
vector<string> words;
string rpr(const string& s){
string c=s;
for(int i=0;i<c.length();i++)
c[i]=tolower(c[i]);
sort(c.begin(),c.end());
return c;
}
int main(){
string str;
while(cin>>str){
if(str[0]=='#') break;
words.push_back(str);
string s=rpr(str);
if(!cnt.count(s)) cnt[s]=0;
cnt[s]++;
}
vector<string>ans;
for(int i=0;i<words.size();i++)
if(cnt[rpr(words[i])]==1) ans.push_back(words[i]);
sort(ans.begin(),ans.end());
for(int i=0;i<ans.size();i++)
cout<<ans[i]<<"\n";
return 0;
}2