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: 2016210402113
In contest: 1084

#include<stdio.h>
#include<string.h>
int main()
{
	int t;
	scanf("%d",&t);
	getchar();
	while(t--)
	{
		char a[111];
		gets(a);
		int i;
		for(i=2;i<strlen(a);i++)
		{
			if((a[i-2]=='s'||a[i-2]=='S')&&(a[i-1]=='s'||a[i-1]=='S')&&(a[i]=='R'||a[i]=='r'))
				a[i-2]='*',a[i-1]='*',a[i]='*';
			if(i>5)
			{
				if((a[i-5]=='A'||a[i-5]=='a')&&(a[i-4]=='f'||a[i-4]=='F')&&(a[i-3]=='r'||a[i-3]=='R')&&(a[i-2]=='i'||a[i-2]=='I')&&(a[i-1]=='c'||a[i-1]=='C')&&(a[i]=='A'||a[i]=='a'))
					a[i-5]='A',a[i-4]='F',a[i-3]='R',a[i-2]='I',a[i-1]='C',a[i]='A';
			}
		}
		puts(a);
	}
}