## ECOO '12 R2 P2 - Password Strength

View as PDF

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

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.

 Example : ECOO()123abcd9876 Example : 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 (upper case letters, lower case letters, digits, and symbols). Score two points for the length plus another two for each of the four types of characters it contains. --
Upper Case Add , where is the number of upper case letters and . --
Lower Case Add , where is the number of lower case 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 Upper Case Subtract for each set of consecutive upper case characters. --
Consecutive Lower Case Subtract for each set of consecutive lower case 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
Stong

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