Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace test
- {
- class MainClass
- {
- public static void Main()
- {
- int[] arr = Console.ReadLine()
- .Split(' ')
- .Select(int.Parse).ToArray();
- var counters = new int[arr.Length];
- var counterMax = 0;
- var number = 0;
- for (int i = 0; i < arr.Length; i++)
- {
- for (int j = i; j < arr.Length; j++)
- {
- if (arr[i] == arr[j])
- {
- counters[i]++;
- if (counterMax < counters[i])
- {
- counterMax = counters[i];
- number = arr[i];
- }
- }
- }
- }
- Console.WriteLine(number);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement