Advertisement
iskren_penev

MinerTask

May 19th, 2016
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _06.AMinerTask
  5. {
  6.     class MinerTask
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string input = Console.ReadLine();
  11.             Dictionary<string, long> collected = new Dictionary<string, long>();
  12.             while (input != "stop")
  13.             {
  14.                 if (!collected.ContainsKey(input))
  15.                 {
  16.                     collected.Add(input, 0);
  17.                 }
  18.                 collected[input] += long.Parse(Console.ReadLine());
  19.                 input = Console.ReadLine();
  20.             }
  21.             foreach (var pair in collected)
  22.             {
  23.                 Console.WriteLine("{0} -> {1}", pair.Key, pair.Value);
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement