标签:
HDOJ题目地址:传送门
3 12ajf fi8x_a ff ai_2
no yes no
#include<stdio.h> #include<string.h> #include<map> #include<iostream> #include<algorithm> using namespace std; int main(){ int n; string s; cin>>n; int flag=1; getchar(); while(n--){ flag=1; getline(cin,s); if(s.size()==0){ printf("no\n"); flag=0; }else if(!((s[0]>='a'&&s[0]<='z')||(s[0]>='A'&&s[0]<='Z')||s[0]=='_')){ printf("no\n"); flag=0; }else{ for(int i=1;i<s.size();i++){ if(((s[i]>='0'&&s[i]<='9')||s[i]=='_'|| (s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))){ }else{ flag=0; printf("no\n"); break; } } } if(flag) printf("yes\n"); } }
标签:
原文地址:http://blog.csdn.net/qq_26891045/article/details/52064885