acm 2043

////////////////////////////////////////////////////////////////////////////////
#include<iostream>
#include<fstream>
#include<string>
#include<stdio.h>
using namespace std;

int main(int argc,char * argv)
{
 int number;
 int a,b,c,d,e,f;
 string s;
 char ch;
 //fstream cin("aaa.txt");
 while(cin>>number)
 {
  ch = cin.get();
  while(number--)
  {
   int flag[4] = {0};
   int slen = 0;
   getline(cin,s);
   slen =s.size();
   for(int i = 0;i<slen;++i)
   {
    if(s[i]<='Z' && s[i]>='A')
    {
     flag[0] = 1;
    }
    else if(s[i]<='z' && s[i]>='a')
    {
     flag[1] = 1;
    }
    else if(s[i]<='9' && s[i]>='0')
    {
     flag[2] = 1;
    }
    else if(s[i] =='~' || s[i] == '!' ||s[i] == '@' || s[i] == '#' || s[i] == '$' || s[i] =='%' || s[i] == '^')
    {
     flag[3] = 1;
    }
   }
   int cnt = flag[0] + flag[1] + flag[2] + flag[3];
   //cout<<cnt<<endl;
   if(slen>=8 && slen <=16 && cnt>=3)
   {
    cout<<"YES"<<endl;
   }
   else
   {
    cout<<"NO"<<endl;
   }
  }

 }
 //getchar();
 return 0;
}

posted @ 2018-03-12 11:13  youqia  阅读(134)  评论(0编辑  收藏  举报