re,求解
查看原帖
re,求解
540704
turtle_egg楼主2023/7/16 16:27
#include<bits/stdc++.h>
using namespace std;
string x,h,z;
int y;
void w(string s,int o)
{
	if(s.size()<=1)
	{
		cout<<s; 
		y++;
		return;
	}
	int n=0;
//	cout<<o; 
	if(o>x.size())
	{
		y--;o--;
	}
	n=s.find(x[o]);
	string qq,hh;
	qq=s.substr(0,n);
	hh=s.substr(n+1);
//	cout<<s<<" |"<<qq<<" *"<<hh<<endl;
	y++;
	w(qq,y);
	w(hh,y);
	cout<<s[n];
	return;
}
int main()
{
	cin>>z>>x;
	w(z,y);
	return 0;
	 
 } 
2023/7/16 16:27
加载中...