求助~看不懂这一步
查看原帖
求助~看不懂这一步
330143
孝天犬学语言楼主2020/6/3 21:56
#include<bits/stdc++.h>
using namespace std;
void sea(string a,string b){
	if(a.size()>0){
		char ch=b[b.size()-1];
		cout<<ch;
		int k=a.find(ch);
		sea(a.substr(0,k),b.substr(0,k));//递归左子树
		sea(a.substr(k+1),b.substr(k,a.size()-k-1));//递归右子树 为什么这样写?
	}
}
int main(){
	string a,b;
	cin>>a>>b;
	sea(a,b);
	return 0;
}
2020/6/3 21:56
加载中...