Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  vector<int> v;
  for(int i=0; i<s.size(); i++) {
    if(s[i]=='e') {
      v.push_back(0);
      i+=2;
    } else {
      v.push_back(1);
      i+=6;
    }
  }
  vector<vector<int> > a;
  vector<int> b;
  b.push_back(v[0]);
  for(int i=1; i<v.size(); i++) {
    if(v[i-1]==v[i]) {
      a.push_back(b);
      b.clear();
    }
    b.push_back(v[i]);
  }
  a.push_back(b);
  int x=0,y=0;
  for(int i=0; i<a.size(); i++) {
    if(a[i].size()>x) {
      x=a[i].size();
      y=a[i][a[i].size()-1];
    }
  }
  if(!y) cout << "egg" << endl;
  else cout << "chicken" << endl;
  return 0;
}
