Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	string in;
	cin >> in;
	vector<vector<int>> buf;
	int last=-1;
	int j = -1;
	for (int i = 0; i < in.size();) {
		int now = in[i] == 'e' ? 0 : 1;
		if (last == now||last==-1) {
			j++;
			vector<int> a;
			buf.push_back(a);
		}
		buf[j].push_back(now);
		last = now;
		i += last ? 7 : 3;
	}
	int max = 0;
	for (auto a : buf) {
		max = std::max(max,(int) a.size());
	}
	for (auto a : buf) {
		if (max == a.size()) {
			cout << (a[a.size() - 1] ? "chicken" : "egg")<<endl;
			break;
		}
	}
	return 0;
}