converter python to c++ code
list=[200500,999508,10003,204090,9876987]
index_list=[]
for i in list:
n=0
i=str(i)
for j in range(len(i)-3):
if i[j]==str(0):
if i[j]==i[j+1]==i[j+2]==i[j+3]:
n+=4
elif i[j]==i[j+1]==i[j+2]:
n+=3
elif i[j]==i[j+1]:
n+=2
index_list.append(n)