#K44132. Password Verification Challenge
Password Verification Challenge
Password Verification Challenge
Your task is to write a program that verifies whether a given password meets a set of criteria. The password must satisfy all the constraints provided. The criteria are given as commands and they include:
- min_length X: The password must have at least X characters, i.e. \(|password| \ge X\).
- max_length X: The password must have at most X characters, i.e. \(|password| \le X\).
- has_digit: The password must contain at least one digit (0-9).
- has_upper: The password must contain at least one uppercase letter (A-Z).
- has_lower: The password must contain at least one lowercase letter (a-z).
- no_special: The password must not contain any special characters (punctuation characters).
If the password satisfies every criterion, output True
; otherwise, output False
.
inputFormat
The input is read from standard input and has the following format:
- The first line contains the password string.
- The second line contains an integer
N
specifying the number of criteria. - The following
N
lines each contain one verification criterion command. Each command can be one of the following:- min_length X
- max_length X
- has_digit
- has_upper
- has_lower
- no_special
outputFormat
Output a single line to standard output containing either True
or False
depending on whether the password meets all the specified criteria.
Pass123
1
min_length 6
True