Danail_Y

Arr

Feb 26th, 2021
1,009
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace ConsoleApp1
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var splitedInput = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
  11.  
  12.             //var input = "2 1 1 2 3 3 2 2 2 1";
  13.             //var splitedInput = input.Split(" ").Select(int.Parse).ToArray();
  14.  
  15.             var cnt = 1;
  16.             var maxCnt = 1;
  17.             var num = string.Empty;
  18.  
  19.             for (int i = 0; i < splitedInput.Length - 1; i++)
  20.             {
  21.                 if (splitedInput[i] == splitedInput[i + 1])
  22.                 {
  23.                     cnt++;
  24.                     if (cnt > maxCnt)
  25.                     {
  26.                         maxCnt = cnt;
  27.                         num = splitedInput[i].ToString();
  28.                     }
  29.                 }
  30.                 else
  31.                 {
  32.                     cnt = 1;
  33.                 }
  34.             }
  35.  
  36.             for (int i = 0; i < maxCnt; i++)
  37.             {
  38.                 Console.Write(num + " ");
  39.             }
  40.         }
  41.     }
  42. }
  43.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×