Ancient Cipher UVA - 1339
程序员文章站
2022-04-02 10:10:08
...
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
string s1, s2;
int cnt1[26], cnt2[26], flag = 1;
while ((cin >> s1 >> s2).good()) {
memset(cnt1, 0, sizeof(cnt1));
memset(cnt2, 0, sizeof(cnt2));
for (int i = 0; i < s1.length(); i++)
cnt1[s1[i] - 'A']++;
for (int i = 0; i < s2.length(); i++)
cnt2[s2[i] - 'A']++;
sort(begin(cnt1), end(cnt1));
sort(begin(cnt2), end(cnt2));
for (int i = 0; i < 26; i++)
if (cnt1[i] != cnt2[i]) {
flag = 0;
break;
}
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl;
flag = 1;
}
return 0;
}
推荐阅读
-
UVA1339 - Ancient Cipher(思维)
-
UVA1339 Ancient Cipher(排序)
-
POJ2159 Ancient Cipher
-
Ancient Cipher UVALive - 3213
-
UVA1339 Ancient Cipher Java版
-
POJ 2159 Ancient Cipher G++
-
古老的密码(Ancient Cipher,NEERC 2004,UVa1339)
-
例题6-13 古代象形符号(Ancient Messages,World Finals 2011,UVa 1103)
-
1339 - Ancient Cipher 算法竞赛第四章
-
uva 1339 Ancient Cipher