0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 18:52:02 +00:00

#1033. 【中山A组 2018.8.15 T1】抄代码

https://sjzezoj.com/submission/37414
This commit is contained in:
Baoshuo Ren 2021-09-30 22:04:25 +08:00 committed by Baoshuo Ren
parent 810d9e19a3
commit 9b665caa0b
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

38
S2OJ/1033/1033.cpp Normal file
View File

@ -0,0 +1,38 @@
#include <bits/stdc++.h>
using namespace std;
int t;
bool ans, flag[26][26];
string a, b;
int main() {
cin >> t;
getline(cin, a);
while (t--) {
memset(flag, 0x00, sizeof(flag));
getline(cin, a);
getline(cin, b);
ans = a.size() == b.size();
if (ans) {
for (int i = 0; i < a.size(); i++) {
if (a[i] == b[i]) continue;
if ('a' > a[i] || a[i] > 'z' || 'a' > b[i] || b[i] > 'z') {
ans = false;
break;
}
for (int j = 0; j < 26; j++) {
if (flag[a[i] - 'a'][j]) {
if (j != b[i] - 'a') {
ans = false;
break;
}
}
}
flag[a[i] - 'a'][b[i] - 'a'] = 1;
}
}
cout << ans << endl;
}
return 0;
}