link:-(https://www.codechef.com/problems/SNELECT/)

my answer:-

```
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
char a[99];
int i,t;
cin>>t;
for(i=0;i<=t;i++)
{ int s=0,m=0;
gets(a);
int sz=strlen(a);
if(a[0]=='s')
s++;
for(int j=1;j<sz;j++)
{
if(a[j]=='s')
{
s++;
}
if(a[j]=='m')
{
m++;
if((a[j-1]=='s')||(a[j+1]=='s'))
{
s--;
}
}
}
if(s>m)
{
cout<<"snakes\n";}
if((s==m)&&(s>0))
{
cout<<"tie\n";}
if(m>s)
{
cout<<"mongooses\n";}
}
return 0;
}
```