大佬救救我,这输出奇怪的东西
查看原帖
大佬救救我,这输出奇怪的东西
305941
RayZhu楼主2020/5/2 21:44
#include <iostream>
#include <string>

using namespace std;


string f(string zhong, string hou)
{
	int i, num;
	num=hou.size();
	if (zhong == "") return "";
	for (i=0; i<zhong.size(); i++) if (zhong[i] == hou[num-1]) break;
	return hou[num-1]    +    f(zhong.substr(0, i-1), hou.substr(i, num-2))    +    f(zhong.substr(0, i), hou.substr(i+1, num-2));
}

int main()
{
	string zhong, hou;
	cin>>zhong>>hou;
	cout<<f(zhong, hou)<<endl;
	return 0;
}

2020/5/2 21:44
加载中...