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: 2ms
Memory: 1096kB
Author: motom
In contest: 1084

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

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