Advertisement
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 ConsoleApp69
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = Convert.ToInt32(Console.ReadLine());
- List<int> list = new List<int>();
- List<int> list1 = new List<int>();
- for (int i = 1; i <= n; i++)
- {
- list = Console.ReadLine().Split(',').Select(Int32.Parse).ToList();
- list1.AddRange(list);
- }
- Dictionary<int, int> brojevi = new Dictionary<int, int>();
- brojevi = list1.GroupBy(x => x).OrderByDescending(x => x.Count()).ToDictionary(y => y.Key, y => y.Count());
- Console.WriteLine("\n");
- for(int i = 0; i < 6; i++)
- {
- Console.WriteLine(brojevi.ElementAt(i).Key);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement