Help In Array Problem

if (1 is repeating consecutively){
    count++;
}

Please Help In This:
If I Wanted To Know That 1 Is Repeating In Array Consecutively
Like In This Array
[2 2 2 1 1 2 2]
1 Is Consecutively 2 Times
[1 2 1 2 1 2]
In This 1 Is Only 1 Time
[2 2 1 1 1 2 2 2 2]
In This 1 Is 3 Times
Actual Problem Link: Problem - 1138A - Codeforces

My Approach
count_consecutive(1)*2

Please Help Me To Solve This
Thanks In Advance
Krishna Wadhwani

Please Help!!

Think something else

TC where your logic fails
1 1 1 2

@sebastian Yes My Approach Was Wrong :slight_smile: