Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 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 ConsoleApplication65
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. SortedDictionary<string, int> players = new SortedDictionary<string, int>();
  14. while (true)
  15. {
  16. string[] command = Console.ReadLine().Split(' ', '-').Where(znak => znak != " ").ToArray();
  17. if (command[0] == "End")
  18. {
  19. break;
  20. }
  21.  
  22. if (players.ContainsKey(command[0]))
  23. {
  24. players[command[0]] += int.Parse(command[3]);
  25. }
  26.  
  27. else
  28. players.Add(command[0],int.Parse(command[3]));
  29. }
  30. foreach(var item in players)
  31. Console.WriteLine("{0} -> {1}",item.Key,item.Value);
  32.  
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement