fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. int[] testArray = {1,5,6,8,9,4,4,6,3,2};
  9.  
  10. var adjacentDuplicate = testArray.Skip(1).Where((value,index) => value == testArray[index]).Distinct();
  11. Console.WriteLine ( adjacentDuplicate.Select (x=>x.ToString()).Aggregate ((a,b) => a+ " " + b));
  12. }
  13. }
  14.  
Success #stdin #stdout 0.05s 34088KB
stdin
Standard input is empty
stdout
4