TheBulgarianWolf

SoftUni Courses

Mar 3rd, 2021
759
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace CoursesSoftUni
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string input;
  11.             Dictionary<string, List<string>> courses = new Dictionary<string, List<string>>();
  12.             while((input = Console.ReadLine()) != "end")
  13.             {
  14.                 string[] inputArr = input.Split(" : ");
  15.                 if (courses.ContainsKey(inputArr[0]))
  16.                 {
  17.                     courses[inputArr[0]].Add(inputArr[1]);
  18.                 }
  19.                 else
  20.                 {
  21.                     courses.Add(inputArr[0], new List<string>());
  22.                     courses[inputArr[0]].Add(inputArr[1]);
  23.                 }
  24.             }
  25.  
  26.             foreach(var item in courses)
  27.             {
  28.                 Console.WriteLine(item.Key + ": " + item.Value.Count);
  29.                 foreach(var participant in item.Value)
  30.                 {
  31.                     Console.WriteLine("-- "+participant);
  32.                 }
  33.             }
  34.         }
  35.     }
  36. }
  37.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×