title: maximal sequence of equal elements in an array
body: <p>I have for homework the exercise: Write a program that finds the maximal sequence of equal elements in an array. Example: {2, 1, 1, 2, 3, 3, 2, 2, 2, 1} = {2, 2, 2}.
  I came up with this: </p>
  
  <pre><code>Console.WriteLine("Enter array lenght");
              int arrLenght = int.Parse(Console.ReadLine());
              int[] arr = new int[arrLenght];
              Console.WriteLine("Enter array elements");
              for (int i = 0; i &lt; arr.Length; i++)
              {
                  arr[i] = int.Parse(Console.ReadLine());
              }
              for (int i = 0; i &lt; arr.Length; i++)
              {
                  if (arr[i] == arr[i + 1] &amp;&amp; arr[i] == arr[i + 2])
                  {
                      Console.WriteLine("Maximal sequence of numbers is: {0},{1},{2}",arr[i],arr[i+1],arr[i+2]);
                      break;
                  }
  
              }
  </code></pre>
  
  <p>This works only if the sequence is exactly 3 numbers long. I have to search the array and find the largest sequence but i don't know how to code this. I'm sorry if the question is silly but i am a newbie and i couldn't find solution anywhere else. Thanks</p>