-= Puzzle 3: Password Competition =-
On your third day at BitFlop Laboratories, you're assigned to help out in the database department.
Apparently, something has gone very wrong with the passwords and you visit the database department to help out.
"What's going on?" you ask.
"The password validator is on vacation," they reply, "and the Password Competition is tomorrow!"
You are a bit confused about what they are saying.
"Oh, you haven't heard? Every year we give an award to the employee with the strongest password..."
You briefly consider explaining why that's a terrible idea, but your colleague is already opening the "database".
The database turns out to be a plain text file containing a list of passwords (your puzzle input).
"We need you to calculate a strength score for every password so we can determine the winner."
The scoring rules are simple, for each password:
- If the password contains at least one lowercase letter (
a-z), add 1 to the score. - If the password contains at least one uppercase letter (
A-Z), add 1 to the score. - If the password contains at least one digit (
0-9), add 1 to the score.
Once you've counted all applicable categories, multiply this score by the length of the password.
For example, consider the following list:
aaaaa111
Ks3SDblu
eowcdredkcasdblu
de333333
7dedlblu
o3klll
8ebluered
DkoGreenD7
green037
The strength scores are:
aaaaa111 -> 2 * 8 = 16 (lowercase letters and digits)
Ks3SDblu -> 3 * 8 = 24 (all three categories)
eowcdredkcasdblu -> 1 * 16 = 16 (only lowercase letters)
de333333 -> 2 * 8 = 16 (lowercase letters and digits)
7dedlblu -> 2 * 8 = 16 (lowercase letters and digits)
o3klll -> 2 * 6 = 12 (lowercase letters and digits)
8ebluered -> 2 * 9 = 18 (lowercase letters and digits)
DkoGreenD7 -> 3 * 10 = 30 (all three categories)
green037 -> 2 * 8 = 16 (lowercase letters and digits)
In this example, DkoGreenD7 has the highest strength score of 30, making it the winner!
Which password has the highest strength score? (Answer is the password itself in string format)