Help me in solving BIS problem

My issue

can any one explain the below approch

My code

# Cook your dish
for _ in range(int(input())):
    n = int(input())
    bins = input()
    zz, zo, oz, oo = 0, 0, 0, 0
    
    for i in range(0, n, 2):
        if bins[i:i+2] == '11':
            oo += 1
        elif bins[i:i+2] == '00':
            zz += 1
        elif bins[i:i+2] == '01':
            zo += 1
        else:
            oz += 1 
    
    ans = 2 * oo + 2 * zz + 2 * min(1, zo) + min(2, oz)
    print(ans)

Problem Link: Binary Substring Practice Coding Problem - CodeChef