-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassword.cpp
More file actions
35 lines (35 loc) · 925 Bytes
/
password.cpp
File metadata and controls
35 lines (35 loc) · 925 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
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
for(int j=0;j<t;j++)
{
string str;
cin>>str;
int len=str.length(),i=0,sa=0,ba=0,num=0,sc=0;
if(len>=10)
{
while(i<len)
{
if(str[i]>='a' && str[i]<='z')
sa=1;
else if(i!=0 && i!=len-1 && str[i]>='A' && str[i]<='Z')
ba=1;
else if(i!=0 && i!=len-1 && (str[i]=='@' || str[i]=='#' || str[i]=='&' || str[i]=='%' || str[i]=='?'))
sc=1;
else if(i!=0 && i!=len-1 && str[i]>='0' && str[i]<='9')
num=1;
i++;
}
if(sa==1 && ba==1 && sc==1 && num==1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
else
cout<<"NO"<<endl;
}
return 0;
}