Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace MaxSequenceOfEqualElements
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] arr = Console.ReadLine().Split();
- int bestCount = 0;
- int bestI = 0;
- for (int i = 0; i < arr.Length; i++)
- {
- string current = arr[i];
- int count = 1;
- for (int j = i + 1; j < arr.Length; j++)
- {
- if (current == arr[j])
- {
- count++;
- }
- else
- {
- break;
- }
- }
- if (count > bestCount)
- {
- bestCount = count;
- bestI = i;
- }
- }
- for (int i = 0; i < bestCount; i++)
- {
- Console.Write(arr[bestI] + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement