Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
#include <string>

using namespace std;

#define EGG 0
#define CHICKEN 1
#define Judge( c ) ((c == 'e')? EGG : CHICKEN)
#define Next( n ) ((n == EGG)? 3 : 7)

int main( void )
{
	string input;
	
	while(cin >> input)
	{
		int len = input.size();
		int pnt = 0, nextpnt = 0;;
		int now, next;
		int age = 0, maxAge = 0;
		int ansType;
		ansType = Judge(input[0]);
		while(true) {
			now = Judge(input[pnt]);
			nextpnt = pnt + Next(now);
			age++;
			if(nextpnt < len) {
				next = Judge(input[nextpnt]);
				if(now == next) {
					if(maxAge < age) {
						maxAge = age;
						ansType = now;
					}
					age = 0;
				}
				pnt = nextpnt;
			}
			else{
				if(maxAge < age) {
					maxAge = age;
					ansType = now;
				}
				age = 0;
				break;
			}
		}
		if(ansType == EGG)
			cout << "egg" << endl;
		else
			cout << "chicken" << endl;
	}
	return 0;
}