G.W. CCC 2024 Prep Problem 2: Emma's Password Problem
Emma is building her new website! She has just one more thing to complete before she can release it to the world: creating a new login system.
So far, she's created a list that contains the following: account credentials and login attempts. Both account credentials and login attempts have a username and password, strings containing only lower-case letters and no longer than 10 characters.
If a new username has been added to the list, it should be interpreted as an account creation. Subsequent username occurrences in the list should be interpreted as login attempts, and if the password matches with the account credentials, they should be granted access to the website. Likewise, a wrong password should deny access to the website. List additions are recorded in live time, with the newest additions being at the bottom of the list.
Emma needs information about the following: the number of accounts and a list of all successful or failed login attempts. Unfortunately, she is fighting in a war against her physics homework, so she'll need your help.
The first line will contain \(N\), the number of items in the list. \(\{\text{1 } \leq N \leq 50 \}\)
The next \(N\) lines will contain two strings, representing the username and password.
The first line should contain \(X\), the number of accounts created.
For each login attempt, print out "ACCESS GRANTED" or "ACCESS DENIED", representing a successful or unsuccessful login attempt.
Sample Input 1:
Sample Output 1:
Submit Solution