没通过?
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
bool check(string s)
{
for (auto &r : s)
{
if (r != 'A' && r != 'P' && r != 'T')
return false;
}
if (s.find("PAT") == string::npos && s.find("PAAT") == string::npos && s.find("PT")==string::npos)
return false;
return true;
}
int main()
{
unsigned n = 8;
string tmps;
string out;
cin >> n;
while(n>0)
{
if (cin >> tmps)
{
if (out.length() == 0)
out = (true == check(tmps) ? "YES" : "NO");
else
out = out + string("\n") + (true == check(tmps) ? "YES" : "NO");
--n;
}
}
cout << out;
system("pause");
return 0;
}