Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

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

int main(){
  string s;
  char pre;
  int Index;
  vector<string> vec[10000];
  Index=0;
  cin >> s;
  for(int i=0;i<s.length();i++){
    if(i != 0 && s[i] == pre)++Index;
    if(s[i] == 'e'){
      vec[Index].push_back("egg");
      pre = 'e';
      i+=2;
    }
    else if(s[i] == 'c'){
      vec[Index].push_back("chicken");
      pre = 'c';
      i+=6;
    }
  }
  int size_max = 0;
  for(int i=0;i<=Index;i++){
    size_max = max(size_max,(int)(vec[i].size()));
  }
  for(int i=0;i<=Index;i++){
    if((int)(vec[i].size()) == size_max){
      cout << vec[i][(int)(vec[i].size())-1] << endl;
      break;
    }
  }

  return 0;
}