反片语 (Ananagrams,UVa 156)
题目描述:

#include <iostream>
#include <string>
#include <cctype>
#include <vector>
#include <map>
#include <algorithm>
using namespace std; map<string,int> msi ;
vector<string> words ;
string re(string &s){
string a = s ;
for(int i=;i<a.length();i++)
a[i] = tolower(a[i]) ;
sort(a.begin(),a.end()) ;
return a ;
}
int main(int argc, char *argv[])
{
string s ;
while(cin >> s){
if(s[] == '#') break ;
words.push_back(s) ;
string r= re(s) ;
if(!msi.count(r)) msi[r] = ;
msi[r] ++ ;
}
vector<string> a ;
for(int i=;i<words.size();i++)
if(msi[re(words[i])] == ) a.push_back(words[i]) ;
sort(a.begin(),a.end()) ;
for(int i=;i<a.size() ;i++) cout << a[i] <<"\n" ;
return ;
}
反片语 (Ananagrams,UVa 156)的更多相关文章
- Ananagrams UVA - 156
Most crossword puzzle fans are used to anagrams - groups of words with the same letters in differe ...
- uva-156(Ananagrams UVA - 156)
map容器的模板题,判断是否能交换字母顺序变成另外一个单词,只需要先把单词都变成小写字母.然后再按字母字典序排序,放入map中进行计数,然后把计数为一的再放入另一个容器,再排序输出即可 我的代码(刘汝 ...
- uva 156 - Ananagrams (反片语)
csdn:https://blog.csdn.net/su_cicada/article/details/86710107 例题5-4 反片语(Ananagrams,Uva 156) 输入一些单词,找 ...
- STL语法——映射:map 反片语(Ananagrams,UVa 156)
Description Most crossword puzzle fans are used to anagrams--groups of words with the same letters i ...
- 反片语(Ananagrams,Uva 156)
输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文 本中的另外一个单词.在判断是否满足条件时,字母不分大小写,但在输出时应保留输入中 的大小写,按字典序进行排列(所有大写字母 ...
- 反片语 UVA 156
//该单词不能通过字母重排,得到输入文本中的另外一个单词.在判断是否满足条件时,字母部分大小写 #include<iostream> #include<vector> #inc ...
- UVa 156 Ananagrams(STL,map)
Ananagrams Most crossword puzzle fans are used to anagrams--groups of words with the same letters ...
- 【UVA - 156 】Ananagrams (set,map,vector)
Ananagrams Descriptions: Most crossword puzzle fans are used to anagrams--groups of words with the ...
- UVA 156 Ananagrams (STL multimap & set)
原题链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&p ...
随机推荐
- Objective-C中,ARC下的 strong和weak指针原理解释
Objective-C中,ARC下的 strong和weak指针原理解释 提示:本文中所说的"实例变量"即是"成员变量","局部变量"即是& ...
- python爬取斗鱼B总直播弹幕
在某群中看到关于弹幕爬取的需求,又因为斗鱼比较OP,就以这个作为切入点. 如果你想了解如何获取弹幕,我的这个例子就可以让你豁然开朗,对于哪些没有开发弹幕的直播或视频平台,就需要用抓包工具获取请求,然后 ...
- Oracle子查询之高级子查询
Oracle 高级子查询 高级子查询相对于简单子查询来说,返回的数据行不再是一列,而是多列数据. 1,多列子查询 主查询与子查询返回的多个列进行比较 查询与141号或174号员工的manager_id ...
- Spring的入门学习笔记 (AOP概念及操作+AspectJ)
AOP概念 1.aop:面向切面(方面)编程,扩展功能不通过源代码实现 2.采用横向抽取机制,取代了传统的纵向继承重复代码 AOP原理 假设现有 public class User{ //添加用户方法 ...
- JavaScript深入之参数按值传递
在<JavaScript高级程序设计>第三版 4.1.3,讲到传递参数: ECMAscript中所有函数的参数都是按值传递 按值传递 也就是,把函数外部的值复制给函数内部的参数,就和把值从 ...
- tp5.1路由报错No input file specified.
问题: 按照官方教安装了框架,打开首页没问题,可是安装教程路由规则打开 "http://127.0.0.1/hello/2" 时, 却报错误 "No input fil ...
- php的基础知识(一)
php(超文本预处理器)定义: php(外文名:php:Hertext Preprocessor,中文名:“超文本预处理器”)是一种通用的开源脚本语言.语法吸收了C语言.Java和Perl的特点,利于 ...
- 关于python的菜鸟教程
1.正则表达式 http://www.runoob.com/regexp/regexp-metachar.html 2.python正则表达死 http://www.runoob.com/python ...
- 使用ntp协议同步本地时间(C语言)
使用ntp协议同步本地时间 同步服务器使用的东北大学网络授时服务:ntp.neu.edu.cn更多ntp服务器 http://www.ntp.org.cn/ 源代码来自网络,经本人精简ntp部分,供大 ...
- java 关键字super和this
super关键字 作用:调用父类的构造器 只能出现在子类的构造其中,并且必须是第一行 super()中的参数,决定了调用父类的那个构造器 注:如果子类构造器中没有出现super,则默认加上super( ...