Need help for COMPlLER problem

for _ in range(int(input())):
s=input()
stack=[]
stack.append(s[0])
ans=0
for i in range(1,len(s)):
if s[i]==‘<’:
stack.append(s[i])
else:
if len(stack)>0:
stack.pop()
if len(stack)==0:
ans=i+1
elif len(stack)<=0:
break
print(ans)

I am unable to find a testcase where this code may go wrong, can somebody help me to understand where I am going wrong. CodeChef: Practical coding for everyone