Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Demo
- {
- class Program
- {
- static void Main(string[] args)
- {
- double[] numbers = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
- var count = new SortedDictionary<double, int>();
- foreach (var num in numbers)
- {
- if (count.ContainsKey(num))
- {
- count[num]++;
- }
- else
- {
- count.Add(num, 1);
- }
- }
- foreach (var num in count)
- {
- Console.WriteLine($"{num.Key} -> {num.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement