Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <iostream>
using namespace std;

bool ansflg;
int idx, n, maxlen;
string s;

int main(){
  while(cin >> s){
    idx = 0;
    n = s.length();
    maxlen = 0;

    while(idx < n){
      bool eggflg = (s[idx] == 'e');
      int len = 0;

      while(idx < n && s[idx] == (eggflg ? 'e' : 'c')){
        if(eggflg) idx += 3;
        else       idx += 7;
        eggflg = !eggflg;
        len++;
      }

      if(maxlen < len){
        maxlen = len;
        ansflg = !eggflg;
      }
    }

    cout << (ansflg ? "egg" : "chicken") << endl;
  }
}