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()
- {
- List<int> numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- numbers.Sort();
- int[] count = new int[numbers.Max() + 1];
- foreach(int n in numbers)
- {
- count[n]++;
- }
- for (int i = 0; i < count.Length; i++)
- {
- if(count[i] > 0)
- {
- Console.WriteLine("{0} -> {1}",i,count[i]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment