Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<double> numbers = Console.ReadLine().Split(' ').Select(double.Parse).ToList();
- var counts = new SortedDictionary<double, int>();
- foreach (var num in numbers)
- {
- if (counts.ContainsKey(num))
- {
- counts[num]++;
- }
- else {
- counts[num] = 1;
- }
- }
- foreach (var num in counts)
- {
- Console.WriteLine("{0} -> {1}",num.Key,num.Value);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement