-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path156.cpp
More file actions
47 lines (43 loc) · 727 Bytes
/
156.cpp
File metadata and controls
47 lines (43 loc) · 727 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
40
41
42
43
44
45
46
47
#include<bits/stdc++.h>
using namespace std;
string toUpperCase(string s)
{
int i;
for(i=0;i<s.length();i++)
{
s[i]=toupper(s[i]);
}
return s;
}
int main()
{
string s,s1;
map< string,pair<string,int> > m;
set<string> res;
pair<string,int> p;
cin>>s;
while(s[0]!='#')
{
s1=toUpperCase(s);
sort(s1.begin(),s1.end());
if(m.find(s1)==m.end())
{
p=make_pair(s,0);
m[s1]=p;
}
else
{
m[s1].second=m[s1].second+1;
}
cin>>s;
}
for (map<string,pair<string,int> >::iterator it = m.begin(); it != m.end(); it++)
{
if(it->second.second==0){
res.insert(it->second.first);
}
}
for(set<string>::iterator it=res.begin();it!=res.end();it++)
printf("%s\n",((string)*it).c_str());
return 0;
}