这题太水了吧,把我在场上卡了四下
我们找俩数组,分别存储两个字符串每个字母的频数即可。
然后这题就秒掉了
#include<bits/stdc++.h>
using namespace std;
int n;
string s, t;
int a[26], b[26];
bool f() {
for (char c : s) a[c - 'a']++;
for (char c : t) b[c - 'a']++;
for (int i = 0; i < 26; i++)
if (a[i] != b[i]) return false;
return true;
}
int main() {
cin >> n >> s >> t;
cout << (f() ? "Yes" : "No") << endl;
return 0;
}