This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

47
GESP/资料/sizeof.cpp Normal file
View File

@@ -0,0 +1,47 @@
#include <bits/stdc++.h>
using namespace std;
bool issimilar(string a, string b) {
if (abs((int)a.size() - (int)b.size()) > 1)
return false;
if (a.size() == b.size()) {
int cnt = 0;
for (int i = 0; i < a.size(); i++) {
if (a[i] != b[i])
if (cnt++ > 1)
return false;
}
return true;
} else {
int cnt = 0;
if (a.size() > b.size())
swap(a, b);
int j = 0;
for (int i = 0; i < a.size();) {
if (a[i] != b[j]) {
cnt++;
j++;
} else {
i++;
j++;
}
}
if (cnt > 1)
return false;
return true;
}
}
int main() {
int T;
cin >> T;
while (T--) {
string a, b;
cin >> a >> b;
if (issimilar(a, b)) {
cout << "similar" << endl;
} else
cout << "not similar" << endl;
}
return 0;
}