kStoikow

Untitled

Oct 29th, 2019
646
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. Create a program that keeps information about Pesho's followers, likes and comments. Keep a record of the followers, each with the likes and comments Pesho has received from them.
  2.  
  3. You will be receiving lines with commands until you receive the "Log out" command. There are four possible commands:
  4.  
  5. => "New follower: {username}":
  6. Add the username, to your records (with 0 likes and 0 comments). If person with the given username already exists ignore the line.
  7.  
  8. => "Like: {username}: {count}":
  9. If the username doesn't exist, add it to your records with the given count of likes.
  10. If the username exist, increase the count of likes with the given count.
  11.  
  12. => "Comment: {username}":
  13. If the username doesn't exist, add it to your records with 1 comment.
  14. If the username exists, increase the count of commens with 1.
  15.  
  16. => "Blocked: {username}":
  17. Delete all records of the given username. If it doesn’t exist, print:
  18. "{Username} doesn't exist."
  19.  
  20. In the end, you have to print the count of followers, each follower with his/her likes and comments (the sum of likes and comments) sorted in descending order by the likes and then by their username in ascending order in the following format:
  21. {count} followers
  22. {username}: {likes+comments}
  23. {username}: {likes+comments}
  24. ...
  25.  
  26. Input
  27. You will be receiving lines until you receive the "Log out" command.
  28. The input will always be valid.
  29. Output
  30. Print the users with their likes in the format described above.
  31.  
  32.  
  33.  
  34. Examples
  35.  
  36. Input
  37. New follower: gosho
  38. Like: gosho: 5
  39. Comment: gosho
  40. New follower: gosho
  41. New follower: tosho
  42. Comment: gosho
  43. Comment: tosho
  44. Comment: pesho
  45. Log out
  46.  
  47.  
  48.  
  49. Output
  50. 3 followers
  51. gosho: 7
  52. pesho: 1
  53. tosho: 1
  54.  
  55.  
  56. Input
  57. Like: A: 3
  58. Comment: A
  59. New follower: B
  60. Blocked: A
  61. Comment: B
  62. Like: C: 5
  63. Like: D: 5
  64. Log out
  65.  
  66.  
  67. Output
  68. 3 followers
  69. C: 5
  70. D: 5
  71. B: 1
Advertisement
Add Comment
Please, Sign In to add comment