题解:P13491 【MX-X14-T1】拼凑基因
Heart_of_Iron · · 题解
解题思路
由于子串是连续的,问题等价于检查
#include <bits/stdc++.h>//I love cpeditor
using namespace std;
int b, e[114], f[114];
int main() {
cin >> b;
string c, d;
cin >> c >> d;
for (int i = 0; i < b; i++) {
e[c[i] - 'a']++;
f[d[i] - 'a']++;
}
bool g = true;
for (int i = 0; i < 26; i++) {
if (e[i] != f[i]) {
g = false;
break;
}
}
cout << (g ? "Yes" : "No");
return 0;
}