#include<stdio.h>
int main()
{
int x,y,z;
int n,i,j;
char str[101];
while(~scanf("%d",&n))
{
if(n<0||n>=10) continue;
for(i=0;i<n;i++)
{
scanf("%s",str);
x=y=z=0;j=0;
while(str[j]=='A') {
x++; j++;
}
if(str[j++]!='P'){
printf("NO\n");
continue;
}
while(str[j]=='A'){
y++; j++;
}
if(str[j++]!='T'){
printf("NO\n");
continue;
}
while(str[j]=='A'){
z++;j++;
}
if(str[j]!='\0'){
printf("NO\n");
continue;
}
if(x*y!=z||y==0) printf("NO\n");
else printf("YES\n");
}
}
}
这个题目跟浙大的一道研究生入学考试的机试题很像!每次做都有不一样的感受!做过的题再做,只是为了更加熟悉!
1003_我要通过!(20)
最新推荐文章于 2019-08-09 14:07:40 发布