UVA156对于map的学习
来源:互联网 发布:淘宝的卜珂会是假的吗 编辑:程序博客网 时间:2024/05/14 15:03
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <map>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
map<string,int> cnt;
vector<string> words;
string repr(const string &s)
{
string ans =s ;
for(int i=0; i<ans.length(); i++)
ans[i] = tolower(ans[i]);
sort(ans.begin(),ans.end());
return ans;
}
int main()
{
int n=0;
string s;
while(cin >> s){
if(s[0] == '#') break;
words.push_back(s);
string r = repr(s);
if(!cnt.count(r)) cnt[r] = 0;
cnt[r]++;
}
vector<string> ans;
for(int i=0; i<words.size(); i++)
if(cnt[repr(words[i])] == 1) ans.push_back(words[i]);
sort(ans.begin(),ans.end());
for(int i=0 ;i<ans.size(); i++)
cout << ans[i] << endl;
}
#include <algorithm>
#include <cstdio>
#include <map>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
map<string,int> cnt;
vector<string> words;
string repr(const string &s)
{
string ans =s ;
for(int i=0; i<ans.length(); i++)
ans[i] = tolower(ans[i]);
sort(ans.begin(),ans.end());
return ans;
}
int main()
{
int n=0;
string s;
while(cin >> s){
if(s[0] == '#') break;
words.push_back(s);
string r = repr(s);
if(!cnt.count(r)) cnt[r] = 0;
cnt[r]++;
}
vector<string> ans;
for(int i=0; i<words.size(); i++)
if(cnt[repr(words[i])] == 1) ans.push_back(words[i]);
sort(ans.begin(),ans.end());
for(int i=0 ;i<ans.size(); i++)
cout << ans[i] << endl;
}
0 0
- UVA156对于map的学习
- UVa156(map的使用)
- UVa156 map
- uva156 Ananagrams (stl map的使用)
- map函数的应用:UVa156-Ananagrams
- Uva156 map容器的使用 sortvecor And map.count
- UVa156 Ananagrams,map
- UVa156 Ananagrams ACM解题报告(巧妙的map)
- UVa156 map set vector/STL
- UVA156 map与set运用
- uva156
- UVA156
- uva156
- uva156
- UVA156
- UVa156
- UVa156
- uva156
- 【手把手】JavaWeb 入门级项目实战 -- 文章发布系统 (第三节)
- html+css:box-sizing属性
- python数字类型介绍以及创建数字值对象引用、删除数字值引用操作实例
- CSS完成一个带跳转功能的导航栏页面(修改之前代码出现乱码的情况)
- Html5+css3+angularjs+jquery+webAPi 开发手机web
- UVA156对于map的学习
- Cogs 12. 运输问题2(有上下界的有源汇最大流)
- 2017-02-21
- RabbitMQ消息队列的总结
- 【手把手】JavaWeb 入门级项目实战 -- 文章发布系统 (第四节)
- 关于maven启动tomcat后出现访问不了主页
- UVA101 对于vector的学习
- 2016十家公司前端面试小记
- [绍棠] UIBezierPath类可以创建基于矢量的路径,可以定义简单的形状,如椭圆或者矩形,或者有多个直线和曲线段组成的形状。