Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace CompanyUsers
- {
- class Program
- {
- public static void Main()
- {
- Dictionary<string, List<string>> companies = new Dictionary<string, List<string>>();
- string command;
- while ((command = Console.ReadLine()) != "End")
- {
- string[] current = command.Split(" -> ");
- string company = current[0];
- string employeeID = current[1];
- if (!companies.ContainsKey(company))
- {
- companies.Add(company, new List<string>());
- }
- if (!companies[company].Contains(employeeID))
- {
- companies[company].Add(employeeID);
- }
- }
- foreach (var company in companies)
- {
- Console.WriteLine($"{company.Key}\n-- {string.Join("\n-- ", company.Value)}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement