Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	string str;
	cin >> str;
	vector<string> data;
	bool eggFlag = false;
	bool chickenFlag = false;
	string temp = "";
	for (int i = 0; i < str.size(); ++i)
	{
		if (str[i] == 'e')
		{
			if (eggFlag)
			{
				data.push_back(temp);
				temp.clear();
			}
			else if (!eggFlag)
			{
				eggFlag = true;
				chickenFlag = false;
			}
			temp += "egg";
			i += 2;
		}
		else
		{
			if (chickenFlag)
			{
				data.push_back(temp);
				temp.clear();
			}
			else if (!chickenFlag)
			{
				eggFlag = false;
				chickenFlag = true;
			}
			temp += "chicken";
			i += 6;
		}
	}
	data.push_back(temp);
	int maxLen = 0;
	for (int i = 0; i < data.size(); ++i)
	{
		maxLen = max(maxLen, (int)data[i].size());
	}
	for (int i = 0; i < data.size(); ++i)
	{
		if (data[i].size() == maxLen)
		{
			if (data[i][data[i].size() - 1] == 'g')
			{
				cout << "egg" << endl;
			}
			else
			{
				cout << "chicken" << endl;
			}
			return;
		}
	}
}

int main()
{
	solve();
	return(0);
}