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;
}
}

最新文章

  1. 根据标记清空页面中所有的input对象
  2. windows服务(installutil.exe)报错。异常来自 HRESULT:0x80131515
  3. CentOS 6.5 搭建 LAMP 环境
  4. snr ber Eb/N0之间的区别与联系
  5. 开启mysql慢查询
  6. [转]处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler”
  7. lintcode:两数组的交 II
  8. 大四实习准备6_android服务
  9. 7.DropDownList的绑定
  10. python语言
  11. jquery提交form表单插件jquery.form.js
  12. DotNetCore跨平台~EFCore连接Mysql的方式
  13. WebSocket 示例
  14. vc的环境变量配置和缺少mspdb60.dll的解决方法
  15. JavaSE编程题
  16. 使用Python脚本分析你的网站上的SEO元素
  17. jenkins不能执行windows下的命令,cmd可执行。
  18. vue项目中postcss-pxtorem的使用及webpack中的配置 css中单位px和em,rem的区别
  19. Kafka实战-Kafka Cluster
  20. ListView与SimpleAdapter(三)

热门文章

  1. (转) SQL 命令
  2. cefSharp在XP下使得程序崩溃记录
  3. SQL Server 2008 备份改进版
  4. 在 Asp.NET MVC 中使用 SignalR 实现推送功能
  5. 2014搜狗前端面经【A事业部】
  6. vim 配置语法高亮 行号标示
  7. win7启动出现蓝屏STOP: 0X0000007B
  8. .NET在IE9中页面间URL传递中文变成乱码的解决办法
  9. 桶排序-Swift
  10. CF160D