vasildiavolo

05. Hands of Cards

Apr 10th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. var players = new Dictionary<string, List<string>>();
  10.  
  11. while (true)
  12. {
  13. List<string> input = Console.ReadLine().Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
  14. if (input[0] == "JOKER")
  15. {
  16. break;
  17. }
  18. List<string> cards = input.Skip(1).ToList();
  19.  
  20. if (players.ContainsKey(input[0]) == false)
  21. {
  22. players.Add(input[0], cards);
  23. }
  24. else
  25. {
  26. players[input[0]].AddRange(cards);
  27. }
  28. }
  29.  
  30. }
  31. }
  32.  
  33. // cards = cards.Distinct().ToList();
Advertisement
Add Comment
Please, Sign In to add comment