题目链接如下:
我的代码如下:
cpp
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
// #define debug
int main(){
#ifdef debug
freopen("0.txt", "r", stdin);
freopen("1.txt", "w", stdout);
#endif
std::string str;
std::vector<std::string> a, b, ans;
std::map<std::string, int> mp;
while(std::cin >> str && str != "#"){
a.push_back(str);
transform(str.begin(), str.end(), str.begin(), ::tolower);
sort(str.begin(), str.end());
b.push_back(str);
mp[str]++;
}
for(int i = 0; i < b.size(); ++i){
if(mp[b[i]] == 1){
ans.push_back(a[i]);
}
}
sort(ans.begin(), ans.end());
for(int i = 0; i < ans.size(); ++i){
printf("%s\n", ans[i].c_str());
}
#ifdef debug
fclose(stdin);
fclose(stdout);
#endif
return 0;
}