hdu-2043パスワード

798 ワード

#include<stdio.h>
#include<string.h>
int main()
{
  int n,k,i;
  char str[56];
  scanf("%d",&n);
  while(n--)
  {
    int a=0,b=0,c=0,d=0;
       scanf("%s",str);
    k=strlen(str);
 for(i=0;i<k;i++)
 {
   if(str[i]>='a'&&str[i]<='z')
     a=1;
   if(str[i]>='A'&&str[i]<='Z')
  b=1;
   if(str[i]>='0'&&str[i]<='9')
  c=1;
   if(str[i]=='~'||str[i]=='!'||str[i]=='@'||str[i]=='#'||str[i]=='$'||str[i]=='%'||str[i]=='^')
     d=1;
   }
   if(a+b+c+d>=3&&k>=8&&k<=16)
    printf("YES
"); else printf("NO
"); } return 0; }