题解
2024-08-02 15:32:53
发布于:云南
6阅读
0回复
0点赞
大小写判断+空格判断+开辟两个新字符串
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b,a1 = "",b1 = "";
getline(cin,a); getline(cin,b);
int l1 = a.size(),l2 = b.size();
for(int i = 0;i < l1;i++){
if(a[i] == ' ') continue;
else if(a[i] >= 'a' && a[i] <= 'z') a1 += a[i] - 32;
else a1 += a[i];
}
for(int i = 0;i < l2;i++){
if(b[i] == ' ') continue;
else if(b[i] >= 'a' && b[i] <= 'z') b1 += b[i] - 32;
else b1 += b[i];
}
if(a1 == b1) cout << "YES";
else cout << "NO";
return 0;
}
这里空空如也
有帮助,赞一个