Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ExamPreparation
- {
- class Startup
- {
- static void Main()
- {
- int[] numbers = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse)
- .ToArray();
- var repeats = from num in numbers
- group num by num into @group
- let count = @group.Count()
- orderby count descending
- select new
- {
- Value = @group.Key,
- Count = count
- };
- var asArray = repeats.ToArray();
- Console.WriteLine(asArray[0].Value);
- }
- }
- }
Add Comment
Please, Sign In to add comment