Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class LongestAreaInArray
- {
- static void Main()
- {
- Console.Write("Please insert how many string will be read: ");
- int strCount = int.Parse(Console.ReadLine());
- string[] words = new string[strCount];
- int index=0;
- int lenght=0;
- int currentCount = 0;
- int count = 0;
- for (int i = 0; i < words.Length; i++)
- {
- words[i] = Console.ReadLine();
- }
- for (int i = 0; i < words.Length; i++)
- {
- if (i==0)
- {
- index = 0;
- lenght = 1;
- }
- else
- {
- if (words[i]!=words[i-1])
- {
- if (currentCount>count)
- {
- count = currentCount;
- index = i;
- }
- currentCount = 0;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement