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 FitnesSeason
- {
- class Program
- {
- static void Main(string[] args)
- {
- var text = Console.ReadLine();
- var dict = new Dictionary<string, List<int>>();
- while (text!="End of season")
- {
- var comand = text.Split(new[] { " - " }
- , StringSplitOptions.RemoveEmptyEntries);
- var gol = int.Parse(comand[1]);
- var name = comand[0];
- if (dict.ContainsKey(name)==false)
- {
- dict.Add(name, new List<int>());
- }
- dict[name].Add(gol);
- text = Console.ReadLine();
- }
- foreach (var item in dict.OrderBy(x=>x.Value.Count).ThenBy(x=>x.Key))
- {
- Console.WriteLine("{0}->{1}"
- ,item.Key,item.Value.Sum());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement