Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
struct S{int length,ancestor; bool operator>(const S&s)const{return length>s.length;}};

vector<S>v;
S s;
void F(int id)
{
	if(s.ancestor == id)
	{
		v.push_back(s);
		s.length=1;
		s.ancestor=id;
	}
	else
	{
		++s.length;
		s.ancestor=id;
	}
}
int main()
{
	char str[8192];
	scanf("%s",str);
	s.length=0;
	s.ancestor=-1;
	for(int i=0; str[i];)
	{
		if(str[i]=='e')
		{
			F(0);
			i+=3;
		}
		else
		{
			F(1);
			i+=7;
		}
	}
	if(s.ancestor>=0)
		v.push_back(s);
	stable_sort(v.begin(),v.end(),greater<S>());
	puts(v[0].ancestor?"chicken":"egg");
}