Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create a program that manages users and Emails sent by users. You need to keep information about their username and their sent Emails. The Emails are represented as strings. You will be receiving lines with commands separated by "->" until you receive the "Statistics" command. There are three possible commands:
- • "Add->{username}":
- o Check if the username exists and if it does print:
- "{username} is already registered"
- If it doesn’t exist, then add the user to the collection of users.
- • "Send->{username}->{Email}"
- o Add the {Email} to the {username}'s collection of sent Emails.
- • "Delete->{username}":
- o Delete the given user, if he exists. If the user doesn’t exist, print:
- "{username} not found!"
- In the end, you have to print the count of users, each user with his/her Emails. Users need to be sorted in descending order by the count of sent Emails and then by their username in ascending order in the following format:
- Users count: {count}
- {username}
- - {Email1}
- - {Email2}
- - {Emailn}
- Input
- • You will be receiving lines until you receive the "Statistics" command.
- • The commands will be in the format described above.
- Output
- • Print the collection in the format described above after the "Statistics" command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement