Can anybody help me where i am wrong in PSHOT problem?

What is wrong with this code???
problem link: https://www.codechef.com/LRNDSA02/problems/PSHOT
x=int(input())
for i in range(x):
y=int(input())
z=input()
a,b,f=0,0,1
for j in range(0,2y-2,2):
if z[j:j+2]==‘10’:
a+=1
elif z[j:j+2]==‘01’:
b+=1
if abs(b-a)>len(z[j+2:])//2:
f=0
print(j+2)
break
if f:
print(2
y)

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

2 Likes

@ssjgz there any problem with my code?:sneezing_face: