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 _11.Equal_Sums
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- int count = 1;
- int lenght = 1;
- int index = 0;
- for (int i = 0; i < numbers.Count - 1; i++)
- {
- if (numbers[i] == numbers[i + 1])
- {
- count++;
- }
- if (count > lenght)
- {
- lenght = count;
- index = numbers[i];
- }
- if (numbers[i] != numbers[i + 1])
- {
- count = 1;
- }
- }
- int[] output = new int[lenght];
- for (int i = 0; i < output.Length; i++)
- {
- output[i] = index;
- Console.Write(string.Join(" ",output[i] + " "));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement