Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
#include <sstream>
using namespace std;


int main(){
	string ln;
	cin >> ln;
	while(~ln.find("eggegg"))ln.replace(ln.find("eggegg"),6,"egg egg");
	while(~ln.find("chickenchicken"))ln.replace(ln.find("chickenchicken"),14,"chicken chicken");
	stringstream ss(ln);
	string t;
	string ans;
	while(ss >> t){
		string c;
		for(int i = 0 ; i < t.size() ;){
			if(t[i] == 'e') c += 'e' , i += 3;
			else if(t[i] == 'c') c += 'c' , i += 7;
		}
		if(c.size() > ans.size()) ans = c;	
	}
	cout << (ans[ans.size()-1]=='c' ? "chicken" : "egg") << endl;
}