-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1182.cpp
More file actions
41 lines (30 loc) · 882 Bytes
/
Copy path1182.cpp
File metadata and controls
41 lines (30 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
string a = "~!@#$%^";
while ( n -- ) {
string str;
cin >> str;
if ( str.size() < 8 || str.size() > 16 ) {
cout << "NO" << endl;
continue;
}
int q[4] = {0, 0, 0, 0};
for ( char i : str ) {
if ( isdigit(i) ) q[0] ++;
if ( i >= 'A' && i <= 'Z' ) q[1] ++;
if ( i >= 'a' && i <= 'z' ) q[2] ++;
if ( a.find(i) != string::npos ) q[3] ++;
}
int cnt = 0;
for ( int i = 0; i < 4; ++ i ) {
if ( q[i] != 0 ) cnt ++;
}
if ( cnt >= 3 ) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}