Result: Accepted
Time: 1ms
Memory: 1096kB
#include <stdio.h>
#include <string.h>
int main ()
{
int a, c, d;
char b[200];
scanf ("%d", &a);
getchar();
while (a--)
{
gets (b);
for (c = 0; c < strlen(b); c++)
{
if ((b[c] == 's' || b[c] == 'S') && (b[c + 1] == 's'|| b[c + 1] == 'S') && (b[c + 2] == 'r'|| b[c + 2] == 'R' ))
{
printf ("***");
c += 2;
}
else if ((b[c] == 'a' || b[c] == 'A') && (b[c + 1] == 'f'|| b[c + 1] == 'F') && (b[c + 2] == 'r'|| b[c + 2] == 'R' ) && (b[c + 3] == 'i' || b[c + 3] == 'I') && (b[c + 4] == 'c'|| b[c + 4] == 'C') && (b[c + 5] == 'a'|| b[c + 5] == 'A' ))
{
printf ("AFRICA");
c += 5;
}
else
printf ("%c", b[c]);
}
printf ("\n");
}
return 0;
}