Can anyone explain to me what is going wrong in the following solution to the first problem of Round G of Google kickstart 2020?
for t in range(1,int(input())+1):
s = input()
l,i,ans,C = len(s),0,0,0
while i < l:
if s[i:i+4] == 'KICK':
C += 1
i += 4
elif s[i:i+5] == 'START':
ans += C
i += 5
else:
i += 1
print('Case #{}: {}'.format(t,ans))