Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Problem_4.Roli___The_Coder
- {
- class Program
- {
- static void Main(string[] args)
- {
- var dic = new Dictionary<string, Dictionary<string, List<string>>>();
- while (true)
- {
- string input = Console.ReadLine();
- if (input == "Time for Code") break;
- var tokens = input.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
- var id = tokens[0];
- var eventName = tokens[1];
- if (!eventName.Contains('#')) continue;
- var names = new List<string>();
- for (int i = 2; i < tokens.Length; i++)
- {
- var participant = tokens[i];
- names.Add(participant);
- }
- names = names.Distinct().ToList();
- if (dic.ContainsKey(id))
- {
- if (!dic[id].ContainsKey(eventName)) continue;
- else if (dic[id].ContainsKey(eventName))
- {
- dic[id][eventName].AddRange(names);
- dic[id][eventName] = dic[id][eventName].Distinct().ToList();
- }
- }
- else if (!dic.ContainsKey(id))
- {
- dic[id] = new Dictionary<string, List<string>>();
- if (!dic[id].ContainsKey(eventName))
- {
- dic[id][eventName] = names;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement