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 Company_Users
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = new Dictionary<string, List<string>>();
- string inputLine = Console.ReadLine();
- while (inputLine != "End")
- {
- List<string> command = inputLine.Split(" -> ").ToList();
- string companyName = command[0];
- string IDOfEmployee = command[1];
- if (!input.ContainsKey(companyName))
- {
- input.Add(companyName, new List<string>());
- }
- if (!input[companyName].Contains(IDOfEmployee))
- {
- input[companyName].Add(IDOfEmployee);
- }
- inputLine = Console.ReadLine();
- }
- foreach (var kvp in input.OrderBy(kvp => kvp.Key))
- {
- Console.WriteLine($"{kvp.Key}");
- foreach (var IdOfEmployee in kvp.Value)
- {
- Console.WriteLine($"-- {IdOfEmployee}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement