Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] command = Console.ReadLine().Split("->");
- Dictionary<string, List<string>> message = new Dictionary<string, List<string>>();
- while (command[0] != "Statistics")
- {
- if (command[0] == "Add")
- {
- if (message.ContainsKey(command[1]))
- {
- Console.WriteLine($"{command[1]} is already registered");
- }
- else
- {
- message[command[1]] = new List<string>();
- }
- }
- if (command[0] == "Send")
- {
- message[command[1]].Add(command[2]);
- }
- if (command[0] == "Delete")
- {
- if (message.ContainsKey(command[1]))
- {
- message.Remove(command[1]);
- }
- else
- {
- Console.WriteLine($"{command[1]} not found!");
- }
- }
- command = Console.ReadLine().Split("->");
- }
- Console.WriteLine($"Users count: {message.Count}");
- foreach (var item in message.OrderByDescending(x => x.Value.Count).ThenBy(x => x.Key))
- {
- Console.WriteLine($"{item.Key}");
- foreach (var kvp in item.Value)
- {
- Console.WriteLine($"- {kvp}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement