hdoj:2043

时间:2022-04-20 08:15:32
#include <iostream>
#include <string> using namespace std; bool judgeSize(string str)
{
int size = str.size();
if (size < || size>)
return false;
return true;
} int isA(string str)
{
for (auto &c : str)
{
if (c >= 'A' && c <= 'Z')
return ;
}
return ;
}
int isa(string str)
{
for (auto &c : str)
{
if (c >= 'a' && c <= 'z')
return ;
}
return ;
}
int is0(string str)
{
for (auto &c : str)
{
if (c >= '' && c <= '')
return ;
}
return ;
}
int isOther(string str)
{
for (auto &c : str)
{
if (c == '~' || c == '!' || c == '@' || c == '#' || c == '$' || c == '%' || c == '^')
return ; }
return ;
}
int main()
{
int M;
string str;
while (cin >> M)
{
while (M--)
{
cin >> str;
if (judgeSize(str))
{
int judge = isA(str) + isa(str) + is0(str) + isOther(str);
if (judge >= )
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
else
{
cout << "NO" << endl;
}
}
}
}