Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

using ld= long double;

struct aa {
	vector<int>v;
	int cost;
};
class Compare {
public:
	bool operator()(const aa&l, const aa&r) {
		return l.cost>r.cost;
	}
};

int main() {
	string st;cin>>st;
	vector<int>v;
	int n=0;
	while (n != st.size()) {
		if (st.substr(n, 3) == "egg") {
			v.push_back(0);
			n+=3;
		}
		else {
			v.push_back(1);
			n+=7;
		}
	}

	vector<vector<int>>sp_v;
	vector<int>nv;
	int pre=-1;
	for (int i = 0; i < v.size(); ++i) {
		if (pre == v[i]) {
			sp_v.emplace_back(nv);
			nv.clear();
		}
		nv.push_back(v[i]);
		pre=v[i];
	}
	sp_v.push_back(nv);

	stable_sort(sp_v.begin(), sp_v.end(), [](const vector<int>&l, const vector<int>&r) {
		return l.size()>r.size();
	});
	int ans=sp_v[0].back();
	if (ans) {
		cout<<"chicken"<<endl;
	}
	else {
		cout<<"egg"<<endl;
	}
	
	return 0;
}
