Advertisement
ss3434

Untitled

Mar 9th, 2020
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. 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:
  2. • "Add->{username}":
  3. o Check if the username exists and if it does print:
  4. "{username} is already registered"
  5. If it doesn’t exist, then add the user to the collection of users.
  6. • "Send->{username}->{Email}"
  7. o Add the {Email} to the {username}'s collection of sent Emails.
  8. • "Delete->{username}":
  9. o Delete the given user, if he exists. If the user doesn’t exist, print:
  10. "{username} not found!"
  11. 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:
  12. Users count: {count}
  13. {username}
  14. - {Email1}
  15. - {Email2}
  16. - {Emailn}
  17. Input
  18. • You will be receiving lines until you receive the "Statistics" command.
  19. • The commands will be in the format described above.
  20. Output
  21. • Print the collection in the format described above after the "Statistics" command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement