Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace FitnesSeason
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var text = Console.ReadLine();
  14. var dict = new Dictionary<string, List<int>>();
  15. while (text!="End of season")
  16. {
  17. var comand = text.Split(new[] { " - " }
  18. , StringSplitOptions.RemoveEmptyEntries);
  19. var gol = int.Parse(comand[1]);
  20. var name = comand[0];
  21. if (dict.ContainsKey(name)==false)
  22. {
  23. dict.Add(name, new List<int>());
  24. }
  25. dict[name].Add(gol);
  26. text = Console.ReadLine();
  27. }
  28. foreach (var item in dict.OrderBy(x=>x.Value.Count).ThenBy(x=>x.Key))
  29. {
  30. Console.WriteLine("{0}->{1}"
  31. ,item.Key,item.Value.Sum());
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement