Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- using System.Linq;
- namespace Courses
- {
- class Program
- {
- static void Main(string[] args)
- {
- var inputType = new Dictionary<string, List<string>>();
- while (true)
- {
- List<string> command = Console.ReadLine().Split(" : ").ToList();
- if (command[0] == "end")
- {
- break;
- }
- if (!inputType.ContainsKey(command[0]))
- {
- inputType.Add(command[0], new List<string>());
- inputType[command[0]].Add(command[1]);
- }
- else
- {
- inputType[command[0]].Add(command[1]);
- }
- }
- foreach (var item in inputType.OrderByDescending(x => x.Value.Count))
- {
- Console.WriteLine($"{item.Key}: {item.Value.Count}");
- //var list = item.Value;
- foreach (var kvp in item.Value.OrderBy(n => n))
- {
- Console.WriteLine($"-- {kvp}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement