Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. class Program
  5. {
  6.     static void Main() // 100/100
  7.     {
  8.         decimal[] input = Console.ReadLine().Split(new[] {" "}, StringSplitOptions.RemoveEmptyEntries).Select(decimal.Parse).ToArray();
  9.         var dictionary = new SortedDictionary<decimal, int>();
  10.  
  11.         for (int i = 0; i < input.Length; i++)
  12.         {
  13.             if (!dictionary.ContainsKey(input[i]))
  14.             {
  15.                 dictionary.Add(input[i], 0);
  16.             }
  17.             dictionary[input[i]]++;
  18.         }
  19.         foreach (var number in dictionary)
  20.         {
  21.             Console.WriteLine("{0} - {1} times", number.Key, number.Value);
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement