Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<vector>
#include<map>
#include<complex>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
template<class T> void vp(T &a,int size){rep(i,size)cout << a[i]<<" ";cout << endl;}

string solve(string &in){
  vector<char> tmp;;
  vector<vector<char> > a;
  rep(i,in.size()){
    if (in[i] == 'h')tmp.push_back(in[i]);
    else if (in[i] == 'g')tmp.push_back(in[i]),i++;//skip eg(g)
  }
  char last = 'a';
  vector<char> b;
  rep(i,tmp.size()){
    if (tmp[i] == last)a.push_back(b),b.clear();
    last = tmp[i];
    b.push_back(last);
  }
  a.push_back(b);

  /*
  rep(i,a.size()){
    rep(j,a[i].size())cout << a[i][j] <<" " ;
    cout << endl;
  }
  cout <<"---" << endl;
  */

  char ret;
  int len=-1;
  rep(i,a.size()){
    //rep(j,a[i].size())cout << a[i][j] <<" " ;cout << endl;
    //cout << a[i].size() <<" " << len << endl;
    if ((int)a[i].size() > len){
      //cout << a[i].size() <<" " << len << endl;
      //cout <<"true "<< endl;
      ret = a[i].back();
      len = a[i].size();
    }
  }
  return ret == 'g'?"egg":"chicken";
}


int main(){
  string in;
  while(cin>>in){
    cout << solve(in) << endl;
  }
}