Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel.DataAnnotations;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.ExceptionServices;
- namespace Array_Rotation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse)
- .ToArray();
- int counter = 1;
- int max = 0;
- int element = 0;
- for (int i = 0; i < numbers.Length - 1; i++)
- {
- // find biggest number
- if (numbers[i] == numbers[i+1])
- {
- counter++;
- }
- else
- {
- counter = 1;
- }
- if (counter > max)
- {
- max = counter;
- element = numbers[i];
- }
- }
- for (int j = 1; j <= max; j++)
- {
- Console.Write($"{element} ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment