例题4-1
https://vjudge.net/problem/UVA-1339
只要个数对得上即可
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string s, t;
while (cin >> s >> t) {
int A[2][26] = {};
for (int i = 0;i<s.length();++i){
++A[0][s[i] - 'A'];
++A[1][t[i] - 'A'];
}
sort(A[0], A[0] + 26);
sort(A[1], A[1] + 26);
bool flag = true;
for (int i = 0; i < 26; ++i)
if (A[0][i] != A[1][i]) { flag = false; break; }
if (flag) cout << "YES" << endl;
else cout << "NO" << endl;
}
}