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: 1700kB
Author: 2016210402110
In contest: 1084

#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<iomanip>
using namespace std;
typedef long long ll;
int main()
{
	int t;
	char a[100000];
	cin>>t;
	getchar();
	while(t--)
	{
		gets(a);
		int len = strlen(a);
		for(int i = 0 ; i < len ; i++)
		{
			if(i+2 < len && (a[i] == 's' || a[i] == 'S') && (a[i+1] == 's' || a[i+1] == 'S') && (a[i+2] == 'r' || a[i+2] == 'R'))
			{
				printf("***"); i+=2;
			}
			else if(i+5 < len && (a[i] == 'a' ||a[i] == 'A') && (a[i+1] == 'f' ||a[i+1] == 'F') && (a[i+2] == 'r' ||a[i+2] == 'R') && (a[i+3] == 'i' ||a[i+3] == 'I') && (a[i+4] == 'c' || a[i+4] == 'C') && (a[i+5] == 'a' || a[i+5] == 'A'))
			{
				printf("AFRICA");i+=5;
			}
			else printf("%c",a[i]);
		}
		printf("\n");
	}
}//AFrica