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