← 返回 walmartlabs 的题目列表Password Validation Based on Rules
类型:online_judge
Given 10 password strings and 5 validation rules, output the rule ids that each password does not comply with.
Rules:
The length should not exceed 16 characters.
Does not contain the string "password", case insensitive.
Contains both uppercase and lowercase letters.
The same letter should not appear more than 4 times; note that a and A are considered different.
Must contain special characters such as @, #, *.
Input:
10 password strings.
Output:
A list of rule ids that each password does not comply with.
Example:
Input:
["Passw0rd!", "12345678", "P@ssword2023", "PASSWORD", "passw0rd123!!$$"]
Output:
{"Passw0rd!": [],
"12345678": [1, 2, 3, 5],
"P@ssword2023": [3],
"PASSWORD": [2, 3, 5],
"passw0rd123!!$$": [1]}
Implement code to accomplish this functionality.
Example
Input
["Passw0rd!", "123", "aABCD@#e", "xxxxxx"]