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 MainClass
- {
- public static void Main(string[] args)
- {
- var metals = new Dictionary<string, int>();
- while (true)
- {
- var input = Console.ReadLine();
- if (input.Equals("stop"))
- {
- break;
- }
- var quantity = int.Parse(Console.ReadLine());
- if ( ! metals.ContainsKey(input) )
- {
- metals[input] = 0;
- }
- metals[input] += quantity;
- }
- foreach (var pair in metals)
- {
- Console.WriteLine($"{pair.Key} -> {pair.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement