文章
40
粉丝
607
获赞
68
访问
419.4k
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
bool panduan(string s)
{
int a[4] = { 0 }, count = 0;
if (s.size() < 8 || s.size() > 16)
return false;
for (int i = 0;i < s.size();i++)
{
if (s[i] >= 'A' && s[i] <= 'Z')
{
a[0] = 1;
}
else if (s[i] >= 'a' && s[i] <= 'z')
{
a[1] = 1;
}
else if (s[i] >= '0' && s[i] <= '9')
{
a[2] = 1;
}
else
{
a[3] = 1;
}
}
for (int i = 0;i < 4;i++)
{
count += a[i];
}
if (count >= 3)
return true;
else
return false;
}
int main()
{
int n, cnt;
string s;
while (cin >> n)
{
for (int i = 0;i < n;i++)
{
cin >> s;
if (panduan(s))
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发