您的位置:首页 > 其它

UVA 1339 Ancient Cipher(水题)

2016-10-03 16:25 344 查看
题意好难看懂。
//
//  main.cpp
//  Richard
//
//  Created by 邵金杰 on 16/10/3.
//  Mail:1016427040@qq.com or jasonshaosjj@gmail.com
//  Copyright © 2016年 邵金杰. All rights reserved.
//

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=100+10;
int a[26],b[26];
char s1[maxn],s2[maxn];
int main()
{
while(scanf("%s%s",s1,s2)!=EOF)
{
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
for(int i=0;s1[i];i++) {a[s1[i]-'A']++;b[s2[i]-'A']++;}
sort(a,a+26);
sort(b,b+26);
bool ok=true;
for(int i=0;i<26;i++) if(a[i]!=b[i]) {ok=false;break;}
if(ok) printf("YES\n");
else printf("NO\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: