求求大佬,就ac了一个
查看原帖
求求大佬,就ac了一个
718594
Celose楼主2022/5/18 16:34
#include<stdio.h>
#include<string.h>
char s1[1000010];
char s2[1000010];
int wz[1000010];
int bor1[1000010];
int main()
{
   scanf("%s",s1);
   scanf("%s",s2);
   int len1,len2,m,bor;
   len1=strlen(s1);
   len2=strlen(s2);
   char *a=s1,*b=s2;
   for(int i=0;i<len1;i++)
   {
   	m=i;
   	for(int k=0;k<len2;k++)
   	{
   		if(a[m]!=b[k])
   		{
   			break;
   		}
   		m++;
   		if(k==len2-1)
   		{
   			wz[i+1]=1;
   		}
   	}
   }
   for(int y=1;y<=len1;y++)
   {
   	if(wz[y]==1)
   	{
   		printf("%d\n",y);
   	}
   }
   for(int u=0;u<len2/2;u++)
   {
   	for(int h=0;h<=u;h++)
   	{
   	    if(b[h]!=b[len2-h-1])
   		{
   			break;
   		}
   		if(h==u)
   		{
   			bor=u+1;
   			bor1[len2-1]=bor;
   		}
   	}
   }
   for(int g=0;g<len2;g++)
   {
   	printf("%d ",bor1[g]);
   }
   return 0;
}
2022/5/18 16:34
加载中...