mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 18:52:02 +00:00
parent
810d9e19a3
commit
9b665caa0b
38
S2OJ/1033/1033.cpp
Normal file
38
S2OJ/1033/1033.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user