Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
#include <string>

using namespace std;

bool solve(string S);

int main()
{
  string S;
  cin >> S;
  if(solve(S)) cout << "chicken" << endl;
  else         cout << "egg" << endl;
  return 0;
}

bool solve(string S){
  int address = 0, length = 0;
  short int state = 0;
  bool first = true;;
  int l = 0;
  while(address < S.size()){
    if(S[address] == 'c'){
      if(state != 1){
	state = 1;
	l++;
	address += 7;
      }
      else{
	if(l > length){
	  length = l;
	  first = true;
	}
	state = 0;
	l = 0;
      }
    }
    else if(S[address] == 'e'){
      if(state != 2){
	state = 2;
	l++;
	address += 3;
      }
      else{
	if(l > length){
	  length = l;
	  first = false;
	}
	state = 0;
	l = 0;
      }
    }
  }

  if(l > length){
    first = state % 2;
  }
  
  return first;
}
