Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApp15
- {
- class Program
- {
- static void Main(string[] args)
- {
- var users = new Dictionary<string, string>();
- string input = null;
- while (input != "Statistics")
- {
- input = Console.ReadLine();
- string[] cmd = input.Split("->");
- string command = cmd[0];
- //string username = cmd[1];
- if (command == "Add")
- {
- if (!users.ContainsKey(cmd[1]))
- {
- users.Add(cmd[1], " ");
- }
- else
- {
- Console.WriteLine($"{cmd[1]} is already registered");
- }
- }
- if (command == "Send")
- {
- users[cmd[1]] += cmd[2];
- //users[cmd[1]].Add(cmd[2]);
- //users[cmd[1]].Add(cmd[2]);
- }
- if (command == "Delete")
- {
- if (users.ContainsKey(cmd[1]))
- {
- users.Remove(cmd[1]);
- }
- else
- {
- Console.WriteLine($"{cmd[1]} not found!");
- }
- }
- }
- //foreach (var kvpLikes in users.OrderByDescending(u => u.Value).ThenBy(u => u.Key))
- //{
- // Console.WriteLine($"{kvpLikes.Key}: {kvpLikes.Value + users[kvpLikes.Key]} ");
- ////}
- foreach (var user in users.OrderBy(u => u.Value).ThenByDescending(u => u.Key))
- {
- Console.Write($"{user.Key}: ");
- Console.WriteLine();
- Console.WriteLine($"- {user.Value} ");
- }
- //foreach (var item in users.OrderBy(x => x.Key))
- //{
- // Console.Write($"{item.Key}");
- // foreach (string shit in item.Value)
- // {
- // Console.WriteLine($"{shit} ");
- // }
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement