Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	string s, t, str;
	vector<string> vs;
	
	cin >> s;
	for(int i=0 ; i < s.size() ; ){
		if( s[i] == 'e' ){
			t.push_back( 'e' );
			i += 3;
		}else if( s[i] == 'c' ){
			t.push_back( 'c' );
			i += 7;
		}
	}
	
	for(int i=0 ; i < t.size() ; i++ ){
		str.push_back( t[i] );
		if( (i+1 < t.size() && t[i] == t[i+1]) || i+1 == t.size() ){
			vs.push_back( str );
			str.clear();
		}
	}
	int m = vs[0].size();
	for(int i=1 ; i < vs.size() ; i++ ){
		m = max( m , (int)vs[i].size() );
	}
	char ans;
	for(int i=0 ; i < vs.size() ; i++ ){
		if( m == vs[i].size() ){
			ans = vs[i][vs[i].size()-1];
			break;
		}
	}
	if( ans == 'c' ){
		cout << "chicken" << endl;
	}else{
		cout << "egg" << endl;
	}
}