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