GitHub - jzplp/aoapc-UVA-Answer: 算法竞赛入门经典 例题和习题答案 刘汝佳 第二版
AC代码
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<ctype.h>
#include<algorithm>
using namespace std;
string convert(string s) {
for(auto i = s.begin(); i != s.end(); ++i) {
*i= tolower(*i);
}
sort(s.begin(), s.end());
return s;
}
int main() {
string s;
map<string, int> m;
set<string> se;
while(cin >> s && s != "#") {
se.insert(s);
string st = convert(s);
if(m.count(st) == 0) {
m[st] = 1;
} else {
m[st]++;
}
}
for(auto i = se.begin(); i != se.end(); ++i) {
if(m[convert(*i)] == 1) {
cout << *i << endl;
}
}
return 0;
}
最后
以上就是花痴酸奶最近收集整理的关于UVA-156 反片语 题解答案代码 算法竞赛入门经典第二版的全部内容,更多相关UVA-156内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复