Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _05.Hand_of_Cards_v3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, List<string>> playerHands = new Dictionary<string, List<string>>();
- while (true)
- {
- List<string> line = Console.ReadLine().Split(',',' ',StringSplitOptions.RemoveEmptyEntries).ToList();
- string player = line[0];
- List<string> hands = new List<string>();
- if (player == "JOKER")
- {
- break;
- }
- if (!playerHands.ContainsKey(player))
- {
- playerHands.Add(player, hands);
- }
- playerHands[player] = line.Skip(1).Distinct().Concat(playerHands[player]).Distinct().ToList();
- }
- foreach (var item in playerHands)
- {
- Console.WriteLine($"{item.Key} {String.Join(" ",item.Value)}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement