标签:hdu
3 12ajf fi8x_a ff ai_2
no yes no
#include <iostream> #include <stdio.h> #include <cstring> using namespace std; int main() { char a[60]; int n; while (cin >>n) { getchar(); while (n--) { int flag = 0; gets(a); int p = strlen(a); if ( !(a[0] == '_' || (a[0] >='a' && a[0] <='z') ||( a[0] >='A' && a[0] <='Z'))) cout << "no" <<endl; else { for (int i=1; i<p; i++) { if ( !(a[i] == '_' || (a[i] >='a' && a[i] <='z') ||( a[i] >='A' && a[i] <='Z') || ( a[i] >= '0'&& a[i] <='9'))) flag++; } if (flag==0) cout << "yes" << endl; else cout << "no" << endl; } } } return 0; }
标签:hdu
原文地址:http://blog.csdn.net/xiaotan1314/article/details/46117627