求助!22分,哪里错了?
查看原帖
求助!22分,哪里错了?
720390
liumusi2022楼主2022/7/9 15:42
#include<bits/stdc++.h>
using namespace std;
string x, y;
void dfs(string x, string y)
{
	char c = x[0];
	int s = x.find(c), len = x.size();
	if(s != 0)
	{
		dfs(x.substr(1, s), y.substr(0, s));
	}
	if(s + 1 <= len - 1)
	{
		dfs(x.substr(s + 1), y.substr(s + 1));
	}
	cout << c;
}
int main()
{
	cin >> x >> y;
	dfs(y, x);
	return 0;
}
2022/7/9 15:42
加载中...