-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPassword.java
46 lines (46 loc) · 1.33 KB
/
Password.java
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
42
43
44
45
46
import java.io.*;
import java.util.Scanner;
public class Main
{
public static void main(String[]args)
{
Scanner ob=new Scanner(System.in);
int t=0,i,len,j,countl=0,countu=0,countd=0,counts=0;
String str;
char ch;
if(ob.hasNextInt())
t=ob.nextInt();
for(i=1;i<=t;i++)
{
str=ob.next();
len=str.length();
if(len>=10)
{
for(j=0;j<len;j++)
{
ch=str.charAt(j);
if((ch>=97)&&(ch<=122))
countl=countl+1;
if((j!=0)&&(j!=len-1))
{
if((ch>=65)&&(ch<=90))
countu=countu+1;
else if((ch>=48)&&(ch<=57))
countd=countd+1;
else if(ch=='@'||ch=='#'||ch=='%'||ch=='&'||ch=='?')
counts=counts+1;
}
}
if((countl!=0)&&(countu!=0)&&(countd!=0)&&(counts!=0))
System.out.println("YES");
else
System.out.println("NO");
countl=0;countu=0;countd=0;counts=0;
}
else
{
System.out.println("NO");
}
}
}
}