My issue
what is the mistake in my approach
My code
t=int(input())
for _ in range(t):
s=input()
snakes=s.count('s')
mongoose=s.count('m')
for i in range(len(s)):
if s[i]=='m':
if i>0 and s[i-1]=='s':
snakes-=1
elif i<len(s)-1 and s[i+1]=='s':
snakes-=1
if snakes>mongoose:
print("snakes")
elif snakes<mongoose:
print("mongooses")
else:
print("tie")
Learning course: Greedy Algorithms
Problem Link: Snakes, Mongooses and the Ultimate Election Practice Problem in Greedy Algorithms - CodeChef