#include <iostream>
#include <string>
using namespace std;
int main()
{
int n, Yi = 0;
string Lu;
scanf("%d%*c", &n);
while (n--)
{
getline(cin, Lu);
int y = Lu.length();
if ((!isalpha(Lu[0])) && Lu[0] != '_')
{
cout << "no" << endl;
continue;
}
else if (isalpha(Lu[0]) || Lu[0] == '_')
{
for (int i = 0; i < y; i++)
{
if ((Lu[i] >= 'a' && Lu[i] <= 'z') || (Lu[i] >= 'A' && Lu[i] <= 'Z') || Lu[i] == '_' || (Lu[i]>='0' && Lu[i]<='9'))
Yi++;
}
}
if ( Yi == y)
cout << "yes" << endl;
else
cout << "no" << endl;
Yi = 0;
}
return 0;
}
HDU ACM 11 2024 C语言合法标识符
最新推荐文章于 2020-01-23 11:16:58 发布