I am Lord Voldemort

Time Limit: 20 Sec  Memory Limit: 256 MB

题目连接

http://acm.uestc.edu.cn/#/problem/show/71

Description

f you have ever read Harry Potter, you would know that the evil and powerful wizard, Lord Voldemort, create this name by permuting his original name, Tom Marvolo Riddle, to I am Lord Voldemort.

Write a program to check whether it is possible to transform a given word to another by permuting its letters.

The length of any given word is greater than 0 and no larger than 50.

Input

The first line is an integer T, the number of test cases. Following T lines each contains two words separated by spaces.

Output

For each test case, Output on a line Yes if it is possible to do the transformation, otherwise output No instead.

Permuting a word is to change the order of its letters, but no new letters can be added and no original letters can be deleted. For example, one can transform aabc to abca, but not to bac, abc, aabca, aacbb.

Words will contain letters only(a-z, A-Z).

A word won't contain any white spaces in itself.

The given two words will not be the same.

You should ignore case when comparing words, i.e. a is the same as A, b is the same as B, etc.

Sample Input

4
TomMarvoloRiddle IamLordVoldemort
stop pots
abbc bac
InternetAnagramServer IRearrangementServant

Sample Output

Yes
Yes
No
Yes

HINT

题意

题解:

傻逼题

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 200000
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=;if(!x){putchar('');puts("");return;}
while(x>)CH[++Num]=x%,x/=;
while(Num)putchar(CH[Num--]+);
puts("");
}
//************************************************************************************** string s1,s2;
map<char,int> H;
int main()
{
//test;
int t=read();
while(t--)
{
H.clear();
cin>>s1>>s2;
for(int i=;i<s1.size();i++)
{
if(s1[i]>='A'&&s1[i]<='Z')
s1[i]=s1[i]-'A'+'a';
H[s1[i]]++;
}
int flag=;
if(s1.size()!=s2.size())
flag=;
for(int j=;j<s2.size();j++)
{
if(s2[j]>='A'&&s2[j]<='Z')
s2[j]=s2[j]-'A'+'a';
if(!flag)
break;
if(!H[s2[j]])
{
flag=;
break;
}
else
H[s2[j]]--;
}
if(flag)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
}

cdoj 71 I am Lord Voldemort 水题的更多相关文章

  1. cdoj 24 8球胜负(eight) 水题

    8球胜负(eight) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/24 ...

  2. cdoj 03 BiliBili, ACFun… And More! 水题

    Article Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...

  3. cdoj 26 遮挡判断(shadow) 水题

    遮挡判断(shadow) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/26 ...

  4. poj 1003:Hangover(水题,数学模拟)

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Descri ...

  5. Identity Card(水题)

    Identity Card Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) To ...

  6. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  7. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  8. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  9. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

随机推荐

  1. Golang做的验证码(2)

    前面一篇文章介绍了2个用Golang做的验证码 http://www.cnblogs.com/ghj1976/p/3392847.html  这里再补充几个: 1.在GAE上使用的Google的验证码 ...

  2. Weblogic修改后台日志输出级别

  3. 使用Maven将Hadoop2.2.0源码编译成Eclipse项目

    编译环境: OS:RHEL 6.3 x64 Maven:3.2.1 Eclipse:Juno SR2 Linux x64 libprotoc:2.5.0 JDK:1.7.0_51 x64 步骤: 1. ...

  4. js混淆工具

    1\  http://www.jasob.com 2\ http://developer.yahoo.com/yui/compressor

  5. MoveTo和MoveBy

    cc.MoveTo是“移动到这里",而cc.MoveBy则是“相对于之前点再移动”,通俗一点就是说这里需要两个坐标pos1(x1,y1),pos2(x2,y2). 如果是cc.MoveTo的 ...

  6. Delphi IOS环境安装

    RAD Delphi XE/10 Seattle 安装IOS.OSX环境安装,IOS模拟器,MAC X 真机可以调试 http://community.embarcadero.com/blogs/en ...

  7. 【多线程】Java线程面试题 Top 50(转载)

    Java线程面试题 Top 50 原文链接:http://www.importnew.com/12773.html   本文由 ImportNew - 李 广 翻译自 javarevisited.欢迎 ...

  8. 使用IIS6.0遇到问题后,常用的几种解决方法

    1.检查 .Net Framework,是否安装完全,不确定的情况下使用:aspnet_regiis.exe -i 或者 aspnet_regiis.exe -r 2.检查 IIS 6.0 其它相关配 ...

  9. Ubuntu下gdb远程调试--warning: Could not load vsyscall page because no executable was specified解决方案

    1. 首先安装gdbserver apt-get install gdbserver 2. 编译-g 程序 gcc -g test_gdb.c -o test_gdb 源码如下: #include & ...

  10. jfinal的ajax例子

    @(编程) 简介 JFinal 是基于 Java 语言的极速 WEB + ORM 框架,其核心设计目标是开发迅速.代码量少.学习简单.功能强大.轻量级.易扩展.Restful. 在拥有Java语言所有 ...