Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _03._Word_Game
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string score = Console.ReadLine();
- SortedDictionary<string, int> scorers = new SortedDictionary<string, int>();
- while (score != "End of season")
- {
- string [] arrayScorers = score.Split(" - ");
- string name = arrayScorers[0];
- int goals = int.Parse(arrayScorers[1]);
- if (!scorers.ContainsKey(name))
- {
- scorers.Add(name, goals);
- }
- else
- {
- int newScore = scorers[name] + goals;
- scorers.Add(name, newScore);
- }
- score = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment