#include<stdio.h> int main() { int m,i,j,count1,count2,count3,count4,count5; char a[50]; while(scanf("%d",&m)!=EOF) { for(i=0;i<m;i++) { scanf("%s",a); count1=count2=count3=count4=0; for(j=0;a[j]!=‘\0‘;j++) { if(a[j]>=‘a‘&&a[j]<=‘z‘) count1=1; else if(a[j]>=‘A‘&&a[j]<=‘Z‘) count2=1; else if(a[j]>=‘0‘&&a[j]<=‘9‘) count3=1; else if((a[j]==‘~‘)||(a[j]==‘!‘)||(a[j]==‘@‘)||(a[j]==‘#‘)||(a[j]==‘$‘)||(a[j]==‘%‘)||(a[j]==‘^‘)) count4=1; } count5=count1+count2+count3+count4; if(j>=8&&j<=16&&count5>=3) printf("YES\n"); else printf("NO\n"); } } }
原文:http://www.cnblogs.com/yc721274287/p/4438346.html