#include <stdio.h>
int main()
{
    int a,b[50],c[100],cu[100],d[100][50],i,p=0,e=0,ab=0;
    scanf("%d",&a);
    for(i=0;i<a;i++)
    {
        scanf("%d",&b[i]);
        c[i]=b[i];
    }
    scanf("%d",&ab);
    for(int j=0;j<ab;j++)
    {
        for(int k=0;k<a;k++)
        {
            scanf("%d",&d[j][k]);
        }
    }
    for(int j=i,t=0;j<i*2;j++)
    {
        c[j]=b[t];
            t++;
    }
    for(int j=i*2-1,k=0;0<j+1;j--,k++)
    {
        cu[k]=c[j]; 
        printf("%d ",cu[k]);
    }
    for(int h=0;h<ab;h++)
    {
        for(int j=0;j<i*2;j++)
            {
            for(int o=0,k=j;k<j+a;k++,o++)
            {
                if(c[k]==d[h][o])
                {
                    p++;
                }
            }
        if(p==a)
        {
            e++;
            for(int o=0;o<a;o++)
            {
                printf("%d ",d[h][o]);
            printf("\n");
        }
        p=0;
        }
        for(int j=0;j<10;j++)
        {
            printf("%d",p);
        }
   
    }
}
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: