#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include<cstdlib>
#include<cstring>
#include <vector>
#include <queue>
#include <map>
#include <sstream> using namespace std;
#define maxn 100100
map<string, int>ma;
std::vector<string> words;
string func(string str) {
string ans = str;
for (int i = ; i < ans.length(); i++) {
ans[i] = tolower(ans[i]);
} sort(ans.begin(), ans.end());
return ans;
}
int main() {
std::ios::sync_with_stdio(false);
string str;
while (cin >> str) {
if (str[] == '#') {
break;
}
words.push_back(str);
string r = func(str);
if (!ma.count(r)) {
ma[r] = ;
}
ma[r]++;
}
std::vector<string> ans;
for (int i = ; i < words.size(); i++) {
if (ma[func(words[i])] == ) {
ans.push_back(words[i]);
}
sort(ans.begin(), ans.end()); }
for (int i = ; i < ans.size(); i++) {
cout << ans[i] << endl;
}
return ;
}

UVa-156 Ananagrams(map映射)的更多相关文章

  1. UVA 156 Ananagrams ---map

    题目链接 题意:输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文本中的另外一个单词.在判断是否满足条件时,字母不分大小写,但在输出时应保留输入中的大小写,按字典序进行排列( ...

  2. uva 156 - Ananagrams (反片语)

    csdn:https://blog.csdn.net/su_cicada/article/details/86710107 例题5-4 反片语(Ananagrams,Uva 156) 输入一些单词,找 ...

  3. UVa 156 Ananagrams(STL,map)

     Ananagrams  Most crossword puzzle fans are used to anagrams--groups of words with the same letters ...

  4. uva 156 (map)

    暑假培训习题 1.用vector<string>储存string类型的输入单词: 2.将vector中的元素逐一标准化后映射进map中,并给map值加一: 3.新建一个空的vector 4 ...

  5. UVA 156 Ananagrams (STL multimap & set)

    原题链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&p ...

  6. UVa 156 Ananagrams

    题意:给出一些单词,在这些单词里面找出不能通过字母重排得到的单词(判断的时候不用管大小写),然后按照字典序输出. 学习的紫书的map= = 将每一个单词标准化 先都转化为小写,再排序(即满足了题目中说 ...

  7. STL语法——映射:map 反片语(Ananagrams,UVa 156)

    Description Most crossword puzzle fans are used to anagrams--groups of words with the same letters i ...

  8. ZOJ 3644 Kitty's Game dfs,记忆化搜索,map映射 难度:2

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4834 从点1出发,假设现在在i,点数为sta,则下一步的点数必然不能是sta的 ...

  9. POJ2503——Babelfish(map映射+string字符串)

    Babelfish DescriptionYou have just moved from Waterloo to a big city. The people here speak an incom ...

随机推荐

  1. mysql 通过测试'for update',深入了解行锁、表锁、索引

    mysql 通过测试'for update',深入了解行锁.表锁.索引 条件 FOR UPDATE 仅适用于InnoDB存储引擎,且必须在事务区块(BEGIN/COMMIT)中才能生效. mysql默 ...

  2. put与putIfAbsent区别

    put与putIfAbsent区别: put在放入数据时,如果放入数据的key已经存在与Map中,最后放入的数据会覆盖之前存在的数据, 而putIfAbsent在放入数据时,如果存在重复的key,那么 ...

  3. 简单了解 DLL中, .def 文件及C#调用C++方法

    DLL中导出函数的声明有两种方式: 1.在函数声明中加上__declspec(dllexport) //以下内容为 .h 文件中的内容 //向外界提供的端口 extern"C" _ ...

  4. Docker镜像加速器配置

    一.为什么要配置Docker镜像加速器 因为我们默认pull的docker镜像是从Docker Hub来下载,由于其服务器在国外,速度会比较慢.因此我们可以配置成国内的镜像仓库,这样可以加速镜像的上传 ...

  5. [English] Time complexity wise this solution is the best among all

    Time complexity wise this solution is the best among all, we can do all operations in O(1) time. 时间复 ...

  6. 【改】利用ALSA库进行音频重采样

    转自:http://www.voidcn.com/article/p-snamarwr-p.html 一.ALSA介绍: 1.简介: 高级Linux声音体系(英语:Advanced LinuxSoun ...

  7. Oracle表空间的创建与删除

    ORACLE中,表空间是数据管理的基本方法,所有用户的对象要存放在表空间中,也就是用户有空间的使用权,才能创建用户对象.否则是不充许创建对象,因为就是想创建对象,如表,索引等,也没有地方存放,Orac ...

  8. office-excel

    Excel打印每张纸都带表头 页面布局--->打印标题--->顶端标题行

  9. for in 中的index

    自己学艺不精... 数据是个对象,想要里面的key 原来 for (item, index) in items 中的index 就是key

  10. 毕设记录(ajax第一次请求失败,之后成功的问题)

    解决方法:将button标签的type属性改为button,而不是submit,将会解决此问题,至于原因,,,还是没太搞清楚..