Start: Jan, 04, 2017 19:40:00
2016年秋季学期程序设计基础期末考试
End: Jan, 04, 2017 21:40:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 1ms
Memory: 1096kB
Author: 2016210402125
In contest: 1084

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int comp(const void *p,const void *q)
{
	return *(int *)q - *(int *)p;
}
void main()
{
	char s[222];
	int n,i,a,j;
	scanf("%d",&n);
	getchar();
	for(i=0;i<=n-1;++i)
	{
		gets(s);
		a = strlen(s);
		for(j=0;j<=a-1;++j)
		{
			if((s[j]=='s'||s[j]=='S')&&(s[j+1]=='s'||s[j+1]=='S')&&(s[j+2]=='r'||s[j+2]=='R'))
			{
				printf("***");
				j += 2;
			}
			else if((j<=a-6)&&(s[j]=='a'||s[j]=='A')&&(s[j+1]=='f'||s[j+1]=='F')&&(s[j+2]=='r'||s[j+2]=='R')&&(s[j+3]=='i'||s[j+3]=='I')&&(s[j+4]=='c'||s[j+4]=='C')&&(s[j+5]=='a'||s[j+5]=='A'))
			{
				printf("AFRICA");
				j += 5;
			}
			else
				printf("%c",s[j]);
		}
		printf("\n");
	}
}