Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
typedef pair < int , bool > Pi;
int main(){
  string s;
  cin >> s;
  vector< Pi > vc;
  bool prev = s[0] == 'e';
  int i;
  if(prev) i = 3, vc.push_back(Pi( 1, true));
  else i = 7, vc.push_back(Pi( 1, false));

  while( i < s.size() ){
    if(s[i] == 'e'){
      if(prev) vc.push_back(Pi( 1, true));
      else prev = vc.back().second = true, vc.back().first++;
      i += 3;
    }else{
      if(!prev) vc.push_back(Pi( 1, false));
      else prev = vc.back().second = false, vc.back().first++;
      i += 7;
    }
  }
  int ret = 0;
  for(int i = 1 ; i < vc.size() ; i++ ){
    if( vc[ret].first < vc[i].first) ret = i;
  }
  cout << (vc[ret].second ? "egg" : "chicken") << endl;
}