Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Order_By_Age
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, int> output = new Dictionary<string, int>();
- string command = Console.ReadLine();
- while (command != "stop")
- {
- int sum = int.Parse(Console.ReadLine());
- if (!output.ContainsKey(command))
- {
- output[command] = sum;
- }
- else
- {
- output[command] += sum;
- }
- command = Console.ReadLine();
- }
- foreach (var num in output)
- {
- Console.WriteLine($"{num.Key} -> {num.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement