题解
2026-02-28 14:51:35
发布于:浙江
6阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main() {
string s,t;
cin>>s>>t;
if (s==t) {
cout<<"Yes"<<endl;
}else {
for (int i=0;i<s.length()-1;++i) {
if (s[i]==t[i+1] and s[i+1]t[i] and s[i]!=s[i+1]) {
swap(s[i],s[i+1]);
break;
}
}
if (st) {
cout<<"Yes"<<endl;
}else {
cout<<"No"<<endl;
}
}
return 0;
}
全部评论 1
#include <bits/stdc++.h>
using namespace std;
int main() {
string s,t;
cin>>s>>t;
if (s==t) {
cout<<"Yes"<<endl;
}else {
for (int i=0;i<s.length()-1;++i) {
if (s[i]==t[i+1] and s[i+1]t[i] and s[i]!=s[i+1]) {
swap(s[i],s[i+1]);
break;
}
}
if (st) {
cout<<"Yes"<<endl;
}else {
cout<<"No"<<endl;
}
}
return 0;
}13小时前 来自 浙江
0






有帮助,赞一个