Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CountNumbers
- {
- class CountNumbers
- {
- static void Main()
- {
- decimal[] nums = Console.ReadLine().Split(' ').Select(decimal.Parse).ToArray();
- SortedDictionary<decimal, int> numbers = new SortedDictionary<decimal, int>();
- foreach(var num in nums)
- {
- numbers[num] = 0;
- }
- foreach(var num in nums)
- {
- numbers[num]++;
- }
- foreach(var n in numbers.Keys)
- {
- if(numbers[n] > 0)
- {
- Console.WriteLine("{0} -> {1}",n,numbers[n]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment