标签:lse space \n map return scanf ret ++ code
#include <string.h>
#include<stdio.h>
#include <map>
using namespace std;
int main() {
int n, p = 0, t = 0;
char s[120];
scanf("%d",&n);
for(int i = 0; i < n; i++) {
scanf("%s",s);
map<char, int> m;
for(int j = 0; j < strlen(s); j++) {
m[s[j]]++;
if (s[j] == ‘P‘) p = j;
if (s[j] == ‘T‘) t = j;
}
if(m[‘P‘] == 1 && m[‘A‘] != 0 && m[‘T‘] == 1 && m.size() == 3 && p * (t-p-1) == strlen(s)-t-1)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
标签:lse space \n map return scanf ret ++ code
原文地址:https://www.cnblogs.com/hebust/p/9498159.html