UVa1339 Ancient Cipher
2015-06-27 13:48
387 查看
#include <iostream>
#include <string>
#include <cstring> // for memset
#include <algorithm>
using namespace std;
int main()
{
int ce[26], co[26];
string encrypted, orginal;
string::size_type i, len;
ios::sync_with_stdio(false);
while (cin >> encrypted >> orginal)
{
memset(ce, 0, sizeof(ce));
memset(co, 0, sizeof(co));
len = orginal.length();
for (i = 0; i < len; ++i)
{
++ce[encrypted[i]-'A'];
++co[orginal[i]-'A'];
}
sort(ce, ce+26);
sort(co, co+26);
if (equal(ce, ce+26, co))
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
#include <string>
#include <cstring> // for memset
#include <algorithm>
using namespace std;
int main()
{
int ce[26], co[26];
string encrypted, orginal;
string::size_type i, len;
ios::sync_with_stdio(false);
while (cin >> encrypted >> orginal)
{
memset(ce, 0, sizeof(ce));
memset(co, 0, sizeof(co));
len = orginal.length();
for (i = 0; i < len; ++i)
{
++ce[encrypted[i]-'A'];
++co[orginal[i]-'A'];
}
sort(ce, ce+26);
sort(co, co+26);
if (equal(ce, ce+26, co))
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
相关文章推荐
- 在EditText中插入表情图片 (CharacterStyle&SpannableString),TextView中显示HTML和图片
- 在EditText中插入表情图片 (CharacterStyle&SpannableString),TextView中显示HTML和图片
- 简洁版2048
- C/C++语言基础
- POJ 1961:Period
- ADF VO排序及VO的三种查询模式(转)
- CRC 详解
- POJ 1961:Period
- Android自定义键盘
- 指针专题
- 三种快速排序算法以及快速排序的优化
- DMALL刘江峰:生鲜市场具有巨大O2O改造空间
- Linux下的一个图形管理工具webmin
- 移动前端—图片压缩上传实践
- samba
- grid++report中篇
- SDK Manager打不开
- js——DOM操作(二)
- 面向对象基础
- django admin 根据用户显示不同的列表以及编辑界面等