Log in to get your input and submit your answers.
Day 02: Intra Passwords
Following a late-night, overly hasty update to the PC authentication system, the sessions database got corrupted. As a result, hundreds of account passwords no longer comply with the school's security policy.
The Bocal extracted the list of stored passwords for you, along with the security rule that is supposed to apply to each of them.
Part 1
Each line in your report contains a security rule followed by its associated password:
1-3 a: abcdeThis rule means that the password must contain the letter a at least 1 time and at most 3 times.
Example
Take this excerpt from the database:
1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc1-3 a: abcdeis valid: it contains the letteraexactly once (which is between 1 and 3).1-3 b: cdefgis invalid: it contains the letterbzero times.2-9 c: cccccccccis valid: it contains the letterc9 times (in the range [2, 9]).
In this example, there are 2 valid passwords.
Analyze your own data file. How many passwords are valid according to their respective rules?