Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
//C++11
#if __cplusplus == 201103L
#include <tuple>
#endif

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
typedef vector<int> vi;

int main(){
  string s;
  while(cin >> s && s != ""){
    vector<int> v;
    REP(i, s.size()){
      if(s[i]=='c'){
        v.push_back(0);
        i += string("chicken").size() - 1;
      }else{
        assert(s[i] == 'e');
        v.push_back(1);
        i += string("egg").size() - 1;
      }
    }
    vector<vi> vs;
    vi tmp;
    REP(i, v.size()){
      if(tmp.size() > 0 && tmp.back() == v[i]){
        vs.push_back(tmp);
        tmp.clear();
      }
      tmp.push_back(v[i]);
    }
    vs.push_back(tmp);
    int maxlen = 0;
    REP(i, vs.size())maxlen = max(maxlen, (int)vs[i].size());
    int ans = -1;
    for(int i = vs.size() - 1; i >= 0; i--)if(vs[i].size() == maxlen){
      ans = vs[i].back();
    }
    if(ans == 0)cout<<"chicken"<<endl;
    else cout<<"egg"<<endl;
  }
  return 0;
}