public static void Main()
bool[] inputArray = new bool[] { true, false, true, false, true, false, false, true };
int[] consecutiveLengths = new int[inputArray.Length];
int currentConsecutiveLength = 1;
for (int i = 0; i < inputArray.Length; i++)
bool currentElement = inputArray[i];
if (i + 1 < inputArray.Length && currentElement == inputArray[i + 1])
currentConsecutiveLength++;
for (int j = i; j >= i - currentConsecutiveLength + 1; j--)
consecutiveLengths[j] = currentConsecutiveLength;
currentConsecutiveLength = 1;
foreach (int length in consecutiveLengths)
Console.WriteLine(length);