Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <set>
#include <iostream>
#include <vector>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)


int main(){
  string s; cin >> s;
  vector<vector<int> > v;

  int prev = -1;
  while(s.size()){
    int now;
    if(s.substr(0, 3) == "egg"){
      now = 0;
    }else{
      now = 1;
    }

    if(now == prev || prev == -1){
      v.push_back(vector<int>());
    }
    v[v.size() - 1].push_back(now);
    prev = now;

    if(now == 0) s = s.substr(3);
    else s = s.substr(7);
  }

  int alen = 0;
  REP(i,v.size()) alen = max<int>(alen, v[i].size());


  REP(i,v.size()){
    if(alen == v[i].size()){
      cout << (v[i][alen - 1] == 0 ? "egg" : "chicken") << endl;
      break;
    }
  }

  return 0;
}