12分求调
  • 板块学术版
  • 楼主zzq13990149004
  • 当前回复2
  • 已保存回复2
  • 发布时间2025/2/7 10:26
  • 上次更新2025/2/7 12:44:50
查看原帖
12分求调
1339254
zzq13990149004楼主2025/2/7 10:26

T211867

#include <bits/stdc++.h>
using namespace std;
char s1[10000001], s2[101],L,L1,a[10000001];
int top=0;
bool pd(int L1)
{
	for(int i=L1,j=top;i>=0;i--,j--)
	{
		if(a[j]!=s2[i])
		{
			return false;
		}	
	}
	return true;
}
int main()
{
	
	cin>>s1>>s2;
	L=strlen(s1);
	L1=strlen(s2);
	for(int i=0;i<L;i++)
	{
		a[++top]=s1[i];
		if(s1[i]==s2[L1-1])
		{
			if(pd(L1-1)) top=top-L1;
		}
	}
	for(int i=1;i<=top;i++)
	{
		cout<<a[i];
	}
	return 0;
}
2025/2/7 10:26
加载中...