Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace CoursesSoftUni
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input;
- Dictionary<string, List<string>> courses = new Dictionary<string, List<string>>();
- while((input = Console.ReadLine()) != "end")
- {
- string[] inputArr = input.Split(" : ");
- if (courses.ContainsKey(inputArr[0]))
- {
- courses[inputArr[0]].Add(inputArr[1]);
- }
- else
- {
- courses.Add(inputArr[0], new List<string>());
- courses[inputArr[0]].Add(inputArr[1]);
- }
- }
- foreach(var item in courses)
- {
- Console.WriteLine(item.Key + ": " + item.Value.Count);
- foreach(var participant in item.Value)
- {
- Console.WriteLine("-- "+participant);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment