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 dankalove
- {
- class Program
- {
- static void Main(string[] args)
- {
- var sladukshava = new SortedDictionary<string, string>();
- string input = Console.ReadLine();
- while (input != "Lumpawaroo")
- {
- if (input.Contains("|")) //0 - side , 1 - user
- {
- string[] spoko = input.Split(new[] { '|', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
- if (!(sladukshava.ContainsKey(spoko[1])))
- {
- sladukshava.Add(spoko[1], spoko[0]);
- }
- }
- if (input.Contains("->")) // 0 - user, 1 - side
- {
- string[] spoko = input.Split(new[] { '-', '>', ' ' } , StringSplitOptions.RemoveEmptyEntries).ToArray();
- if (!(sladukshava.ContainsKey(spoko[0])))
- {
- sladukshava.Add(spoko[0], spoko[1]);
- }
- else
- {
- sladukshava[spoko[0]] = spoko[1];
- Console.WriteLine($"{spoko[0]} joins the {spoko[1]} side!");
- }
- }
- input = Console.ReadLine();
- }
- var leko = new SortedDictionary<string, int>();
- for (int i = 0; i < sladukshava.Count; i++)
- {
- if (leko.ContainsKey(sladukshava.ElementAt(i).Value))
- {
- leko[sladukshava.ElementAt(i).Value]++;
- }
- else
- {
- leko.Add(sladukshava.ElementAt(i).Value, 1);
- }
- }
- for (int i = 0; i < leko.Count; i++)
- {
- Console.WriteLine("Side: " + leko.ElementAt(i).Key + ", Members: " + leko.ElementAt(i).Value);
- string[] manqches = sladukshava.Where(pair => pair.Value == leko.ElementAt(i).Key).Select(pair => pair.Key).ToArray();
- for (int j = 0; j < manqches.Length; j++)
- {
- Console.WriteLine("! " + manqches[i]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement