Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Lists
- {
- class Program
- {
- static void Main(string[] args)
- {
- SortedDictionary<string, int> points = new SortedDictionary<string, int>();
- while(true)
- {
- string command = Console.ReadLine();
- if (command == "END")
- {
- break;
- }
- string[] input = command.Split('-').ToArray();
- string name = input[0];
- int p = int.Parse(input[1]);
- if (!points.ContainsKey(name))
- {
- points.Add(name, p);
- }
- else
- {
- points[name] += p;
- }
- }
- foreach (var item in points)
- {
- Console.WriteLine($"{item.Key}->{item.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement