标签:
#include <stdio.h> int main(void) { int n,sum; int a,b,c; //a:beforeP,b:betweenPandT,c:afterT int j = 0; scanf("%d",&n); char input[n][101]; for (int i = 0; i<n; i++) scanf("%s",&input[i]); for (int i = 0; i<n; i++) { a = b = c = j = 0; while (input[i][j] == ‘A‘) { a++;j++; } if (input[i][j++] != ‘P‘) { printf("NO\n"); continue; } while (input[i][j] == ‘A‘) { b++;j++; } if (input[i][j++] != ‘T‘) { printf("NO\n"); continue; } while (input[i][j] == ‘A‘) { c++;j++; } if (input[i][j++] != ‘\0‘) { printf("NO\n"); continue; } if (a*b !=c || b==0) printf("NO\n"); else printf("YES\n"); } }
看着http://blog.csdn.net/fang_abc/article/details/43312135还有http://www.ithao123.cn/content-3764850.html照抄出来的,感谢。
标签:
原文地址:http://www.cnblogs.com/sjdeak/p/4771025.html