Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _2._8.Company_Users
- {
- class Program
- {
- static void Main()
- {
- SortedDictionary<string, List<string>> companies = new SortedDictionary<string, List<string>>();
- while (true)
- {
- string[] commnad = Console.ReadLine().Split(new char[] { ' ', '-', '>' }, StringSplitOptions.RemoveEmptyEntries);
- if (commnad[0] == "End")
- {
- break;
- }
- if (!companies.ContainsKey(commnad[0]))
- {
- companies.Add(commnad[0], new List<string>() { commnad[1] });
- }
- else
- {
- if (!companies[commnad[0]].Contains(commnad[1]))
- {
- companies[commnad[0]].Add(commnad[1]);
- }
- }
- }
- foreach (var kvp in companies)
- {
- Console.WriteLine($"{kvp.Key}");
- foreach (var id in kvp.Value)
- {
- Console.WriteLine($"-- {id}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment