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 _03.LongestAreaInArray
- {
- class LongestAreaInArray
- {
- static void Main()
- {
- int amountOfStrings = int.Parse(Console.ReadLine());
- string lastString = "";
- string biggestString = "";
- int biggestCounter = 0;
- int counter = 1;
- for (int i = 0; i < amountOfStrings; i++)
- {
- string currentString = Console.ReadLine();
- if (currentString.Equals(lastString))
- {
- counter++;
- }
- else
- {
- counter = 1;
- }
- if (biggestCounter < counter)
- {
- biggestCounter = counter;
- biggestString = currentString;
- }
- lastString = currentString;
- }
- Console.WriteLine(biggestCounter);
- for (int i = 0; i < biggestCounter; i++)
- {
- Console.WriteLine(biggestString);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment