help
查看原帖
help
663164
chris731楼主2023/12/4 21:58
#include <bits/stdc++.h>
using namespace std;
#define ll long long
string z,h;
int n;
int f(char c){
	for(int i=0;i<n;i++){
		if(z[i]==c){
			return i;
		}
	}
}
void q(int l,int r){
    cout<<h[r];
	int x=f(h[r]);
	if(l==r){
		return;
	}
	if(x!=l){
		q(l,x-1);
	}
   	if(x!=r){
   		q(x,r-1);	
	}
}
int main(){
	//freopen("xxx.in", "r", stdin);
	//freopen("xxx.out", "w", stdout);
	cin>>z>>h;
	n=z.size();
	q(0,n-1);
	return 0;
}

2023/12/4 21:58
加载中...