杭电OJ2043
#include<cstdio>
#include<string.h>
int main(){
int n;
char sp[7]={'~','!','@','#','$','%','^'};
scanf("%d",&n);
while(n--){
char str[51];
int f1=0,f2=0,f3=0,f4=0;
scanf("%s",str);
if(strlen(str)<8||strlen(str)>16){
printf("NO\n");
}else{
for(int i=0;i<strlen(str);i++){
if(str[i]>='a'&&str[i]<='z'){
f2=1;
}else if(str[i]>='A'&&str[i]<='Z'){
f1 = 1;
}else if(str[i]>='0'&&str[i]<='9'){
f3 =1;
}else{
for(int j = 0;j<7;j++){
if(str[i]==sp[j]){
f4=1;
}
}
}
}
if((f1+f2+f3+f4)>=3){
printf("YES\n");
}else{
printf("NO\n");
}
}
}
return 0;
}