Passwords are the most basic information protection devices. But many people compromise the security of their data by choosing passwords that are easy for a human or a bot to guess. The table below summarizes one set of criteria for determining the strength of a password, and shows how to apply these criteria to two different example passwords.
ECOO()123abcd9876
1234512345
Score | Description | Ex 1 | Ex 2 |
---|---|---|---|
Length | Score |
||
Basic Requirements | To qualify, must be at least |
— | |
Uppercase | Add |
— | |
Lowercase | Add |
— | |
Digits | Add |
— | |
Symbols | Add |
— | |
Middle Digits and Symbols | Add |
||
Letters Only | If the password contains only letters, subtract |
— | — |
Digits Only | If the password contains only digits, subtract |
— | |
Consecutive Uppercase | Subtract |
— | |
Consecutive Lowercase | Subtract |
— | |
Consecutive Digits | Subtract |
||
Sequential Letters | Subtract abcd or CBA but not aBcD or SJD or a ). |
— | |
Sequential Digits | Subtract 9876 but not 28 or 6 ). |
||
TOTAL SCORE | Add up all the above. Negative scores become Very Weak , Weak , Good , Strong , Very Strong |
Very Strong |
Very Weak |
* A symbol is any character that is not a letter or digit.
The input contains ten passwords, one per line. Write a program that reads each password, computes its total score based on the above criteria, and categorizes the password as Very Weak
, Weak
, Good
, Strong
, or Very Strong
.
Sample Input
ECOO()123abcd9876
1234512345
ecoo2012
Sample Output
Very Strong (score = 100)
Very Weak (score = 19)
Good (score = 47)
Note: Only cases are shown in this sample.
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
All the sample inputs for my code output correctly, but I still don't pass all the test cases, can somebody give me a hint of where the mistake is for my code