https://vjudge.net/contest/357812#problem/E
复制排版有问题,算了。
对字符串的处理,感觉用C++会好写一点,C好麻烦
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
char re[110][110];
int main()
{
int casee;
scanf("%d",&casee);
for(int o=0;o<casee;o++)
{
char ch;
getchar();
if(o!=0)
{
while((ch=getchar())!='\n');
}
memset(re,0,sizeof(re));
int i=0,j=0,n;
while((ch=getchar())!='\n')
{
if(ch!=' ')
{
re[i][j]=ch;
j++;
}
else {i++;j=0;}
}
//printf("1\n");
n=i+1;
int sum=i;
for(;;)
{
char an[110],vo[110],go[5];
scanf("%s %s %s",an,go,vo);
if(!strcmp(an,"what")) break;
for(i=0;i<n;i++)
{
if(!strcmp(vo,re[i])) {memset(re[i],0,sizeof(re[i]));sum--;}
}
}
//printf("2\n");
for(i=0;i<n;i++)
{
if(strcmp(re[i],"\0"))
{
printf("%s",re[i]);
if(sum!=0) printf(" ");
sum--;
}
}
printf("\n");
}
return 0;
}