Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace CountNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- var sequence = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- var dictionary = sequence.GroupBy(x => x).ToDictionary(x => x.Key, x => x.Count());
- foreach (var pair in dictionary.OrderBy(x=>x.Key))
- {
- Console.WriteLine($"{pair.Key} -> {pair.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement