题解
2023-03-17 22:10:49
发布于:上海
166阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
void f(string a,string b){
int len=a.size();
if(len==0){
return ;
}
int pos=a.find(b[len-1]);
cout<<b[len-1];
f(a.substr(0,pos),b.substr(0,pos));
f(a.substr(pos+1,len-pos-1),b.substr(pos,len-pos-1));
}
int main(){
string a,b;
cin>>a>>b;
f(a,b);
return 0;
}
全部评论 1
把bits/stdc++.h换成iostream可以节省一些内存
2024-05-12 来自 上海
0
有帮助,赞一个