Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace NumberInputAndSorting
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, uint> numbers = new Dictionary<string, uint>();
- string input = Console.ReadLine();
- while (input != "stop")
- {
- if (numbers.ContainsKey(input))
- {
- numbers[input]++;
- }
- else
- {
- numbers.Add(input, 1);
- }
- input = Console.ReadLine();
- }
- var result = numbers.OrderByDescending(x => x.Value);
- foreach (var number in result)
- {
- Console.WriteLine("{0} -> {1}", number.Key, number.Value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement