蒟蒻求救
查看原帖
蒟蒻求救
703319
Sylvia_starx楼主2022/8/28 10:08
#include<bits/stdc++.h>
using namespace std;
void dfs(string z,string h)
{
	if(z.size() == 0)
		return;
	char rt = h[h.size()-1];
	int pos = z.find(rt);
	cout<<rt;
	dfs(z.substr(0,pos),h.substr(0,pos));
	dfs(z.substr(pos+1),h.substr(pos,h.size()-1));
}
int main(){
	string z,h;
	cin>>z>>h;
	dfs(z,h); 
	return 0;
}

帮帮本蒟蒻吧!^o^

2022/8/28 10:08
加载中...