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