'commit'
This commit is contained in:
26
TangDou/KaoShi/字符串对比.cpp
Normal file
26
TangDou/KaoShi/字符串对比.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
string a, b;
|
||||
|
||||
bool check(string a, string b) {
|
||||
for (int i = 0; i < a.size(); i++) {
|
||||
if (a[i] >= 'A' && a[i] <= 'Z') a[i] = a[i] + 32;
|
||||
if (b[i] >= 'A' && b[i] <= 'Z') b[i] = b[i] + 32;
|
||||
if (a[i] != b[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
cin >> a >> b;
|
||||
if (a.size() != b.size())
|
||||
cout << 1 << endl;
|
||||
else if (a == b)
|
||||
cout << 2 << endl;
|
||||
else if (a.size() == b.size() && check(a, b))
|
||||
cout << 3 << endl;
|
||||
else
|
||||
cout << 4 << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user