#t122. 密码强度
密码强度
Password Strength
Problem Description
Little Yang is a member of the school's cybersecurity club. Today his task is to design a "password strength checker" to help classmates see whether their passwords are secure enough. A secure password must satisfy the following:
- At least characters long (a too-short password is easy to guess!).
- At least one uppercase letter (any of
A,B,C, ...,Z). - At least one digit (any of
0,1,2,3, ...,9).
For example:
PAs1s2anis secure (8 characters, with uppercaseP,Aand digits , ).ab1da3cdis not secure (no uppercase letter).Paabdbcdis not secure (no digit).Pa2is not secure (only characters, too short).
Input Format
The first line contains a positive integer , the number of passwords to check.
For each password, one line contains a string: the password to check.
Output Format
For each password, output one line: if it meets the strength requirements output Y, otherwise output N.
Sample Input
6
PAs1s2an
1a2bCql3
Pa12bsna
ab1da3cd
Paabdbcd
Pa2
Sample Output
Y
Y
Y
N
N
N
Sample Explanation
There are passwords to check, and the checker gives its verdict on each:
PAs1s2anhas length , with uppercaseP,Aand digits , ; satisfies all three conditions, so outputY.1a2bCql3has length , with uppercaseCand digits , , ; satisfies all conditions, so outputY.Pa12bsnahas length , with uppercasePand digits , ; satisfies all conditions, so outputY.ab1da3cdhas length and has digits, but no uppercase letter; fails the uppercase requirement, so outputN.Paabdbcdhas length and has uppercase, but no digit; fails the digit requirement, so outputN.Pa2has length only ; fails the length requirement, so outputN.
Constraints
For all test cases, , each password has length with , and consists only of uppercase letters, lowercase letters, and digits.