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 _5.Hands_of_cards
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- var dict = new Dictionary<string, string>();
- while (!input.Equals("end"))
- {
- var textList = input.Split('=',' ').ToList();
- string userName = textList[5];
- if (!dict.ContainsKey(userName))
- {
- dict[userName] = textList[1];
- }
- else
- {
- dict[userName] += (" " + string.Join("", textList[1].Take(12)));
- }
- input = Console.ReadLine();
- }
- foreach (var item in dict.Keys.OrderBy(x => x))
- {
- var itemVAlue = dict[item].Split().ToList();
- var itemValueDist = dict[item].Split().Distinct().ToList();
- string currentText = "";
- Console.WriteLine(item + ": ");
- foreach (var ip in itemValueDist)
- {
- int counter = 0;
- currentText += ($"{ip} => ");
- for (int i = 0; i < itemVAlue.Count; i++)
- {
- if (itemVAlue[i].Equals(ip))
- {
- counter++;
- }
- }
- currentText += counter + ", ";
- counter = 0;
- }
- Console.WriteLine(string.Join("", currentText.Take(currentText.Length - 2)) + '.');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement