Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class LongestArea
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- string[] array = new string[n];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = Console.ReadLine();
- }
- int length = 0;
- string value = null;
- for (int i = 0; i < array.Length; i++)
- {
- int count = 0;
- for (int j = i; j < array.Length; j++)
- {
- if (array[i] == array[j])
- {
- count++;
- }
- else
- {
- break;
- }
- }
- if (length < count)
- {
- length = count;
- value = array[i];
- }
- }
- Console.WriteLine(length);
- for (int i = 0; i < length; i++)
- {
- Console.WriteLine(value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement