Result: Accepted
Time: 2ms
Memory: 1096kB
#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);
}
}