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 points for each character in the password. | ||
Basic Requirements | To qualify, must be at least chars long and also contain of the four basic character types (uppercase letters, lowercase letters, digits, and symbols*). Score two points for the length plus another two for each of the four types of characters it contains. | — | |
Uppercase | Add , where is the number of uppercase letters and . | — | |
Lowercase | Add , where is the number of lowercase letters and . | — | |
Digits | Add , where is the number of digits, but only if . | — | |
Symbols | Add , where is the number of symbol characters. | — | |
Middle Digits and Symbols | Add , where is the number of digits and symbols not in the first or last position. | ||
Letters Only | If the password contains only letters, subtract point for each letter. | — | — |
Digits Only | If the password contains only digits, subtract point for each digit. | — | |
Consecutive Uppercase | Subtract for each set of consecutive uppercase characters. | — | |
Consecutive Lowercase | Subtract for each set of consecutive lowercase characters. | — | |
Consecutive Digits | Subtract for each set of consecutive digits. | ||
Sequential Letters | Subtract , where is the length of the longest case-sensitive sequence of letters longer than (e.g. abcd or CBA but not aBcD or SJD or a ). |
— | |
Sequential Digits | Subtract , where is the length of the longest sequence of digits longer than (e.g. 9876 but not 28 or 6 ). |
||
TOTAL SCORE | Add up all the above. Negative scores become . Scores over 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