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