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 number = 0;
- var counter = 0;
- var maxCounter = 0;
- for (int i = 0; i < arr.Length; i++)
- {
- for (int j = i; j < arr.Length; j++)
- {
- if (arr[i] == arr[j])
- {
- counter++;
- if (maxCounter < counter)
- {
- maxCounter = counter;
- number = arr[i];
- }
- }
- }
- counter = 0;
- }
- Console.WriteLine(number);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement