#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. 推荐一个SAM文件或者bam文件中flag含义解释工具

    SAM是Sequence Alignment/Map 的缩写.像bwa等软件序列比对结果都会输出这样的文件.samtools网站上有专门的文档介绍SAM文件.具体地址:http://samtools. ...

  2. C++ 获取Unix时间戳

    什么是Unix时间戳? Unix时间戳(Unix timestamp),或称Unix时间(Unix time).POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间1970 ...

  3. SSH无法连接到服务器

    SSH服务器会无法连接,有时候并不是密码的问题,可能由于你上次改了密码(就算改成跟上次一样也是一个效果)导致家目录下的known_hosts(/root/.ssh/known_hosts)不一样了并且 ...

  4. Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded

    asp.net  更新数据时报错:Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data ...

  5. 实验十一 团队项目设计完善&编码测试

    任务一: 根据OOD详细设计工作要点,修改完善团队项目系统设计说明书和详细设计说明,将完善后内容以<XX团队项目软件设计方案>为名发布在团队博客中,博文中要突出对完善内容的陈述说明,修改部 ...

  6. hive中控制文件生产个数

    在有些时候,想要控制hql执行的mapper,reducer个数,reducer设置过少,会导致每个reducer要处理的数据过多,这样可能会导致OOM异常,如果reducer设置过多,则会导致产生很 ...

  7. LeetCode--035--搜索插入位置(java)

    给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引.如果目标值不存在于数组中,返回它将会被按顺序插入的位置. 你可以假设数组中无重复元素. 示例 1: 输入: [1,3,5,6], 5 输 ...

  8. web前端常见面试题

    转载自:https://www.cnblogs.com/jj-z/p/7999538.html 一.理论知识 1.1.讲讲输入完网址按下回车,到看到网页这个过程中发生了什么 a. 域名解析 b. 发起 ...

  9. CF #552(div3)G 最小lcm

    题目链接:http://codeforces.com/contest/1154/problem/G 题意:lcm是最小公倍数,本题就是给你一个数组(可能会重复),要求你判断出那两个数的最小公倍数最小, ...

  10. zzw原创_cmd下带jar包运行提示 “错误: 找不到或无法加载主类 ”

    在windows下编译java,由于是临时测试一下文件,不想改classpath,就在命令行中用 -cp 或classpath引入jar包,用javac编译成功,便使用java带-cp 或classp ...