Code: Select all
#include <stdio.h>
#include <string.h>
#define MAX 100010
int main()
{
char S[MAX],q[1010],c;
int i,j,query,test;
scanf("%d%c",&test,&c);
while( test-- )
{
gets(S);
scanf("%d%c",&query,&c);
while( query-- )
{
gets(q);
j = 0;
for( i=0; q[i]; i++ )
{
if( q[i] != S[i] )
{
j = 1;
break;
}
}
if( j )
printf("n\n");
else
printf("y\n");
}
}
return 0;
}