Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

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

#define DEBUG(x) cerr << #x << " = " << x << endl

int main() {
    string str; cin >> str;
    string zip;
    for(int i = 0; i < (int)str.length(); ) {
        if(str[i] == 'e') {
            zip.push_back('e');
            i += 3;
        }
        else {
            zip.push_back('c');
            i += 7;
        }
    }
    vector<string> split;
    split.push_back(zip.substr(0, 1));
    for(int i = 1; i < (int)zip.length(); i++) {
        if(zip[i - 1] == zip[i]) {
            split.push_back(zip.substr(i, 1));
        }
        else {
            split.rbegin()->push_back(zip[i]);
        }
    }
#if 0
    for(int i = 0; i < (int)split.size(); i++) {
        DEBUG(split[i]);
    }
#endif
    string longest;
    for(int i = 0; i < (int)split.size(); i++) {
        if(split[i].size() > longest.size()) longest = split[i];
    }
    cout << (*longest.rbegin() == 'e' ? "egg" : "chicken") << endl;
}