Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include<iostream>
#include<string>
#include<cctype>
#include<cstring>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string s;
	cin>>s;
	vector<string> spot;
	vector<int> parent;
	vector<int> root;
	while(s.size()){
		root.push_back(0);
		parent.push_back(0);
		if(s[0]=='e'){
			spot.push_back(s.substr(0,3));
			s=s.substr(3,s.size()-3);
		}else if(s[0]=='c'){
			spot.push_back(s.substr(0,7));
			s=s.substr(7,s.size()-7);
		}
	}
	parent[spot.size()-1]=spot.size()-1;
	root[spot.size()-1]=0;
	int cnt=0;
	for(int i=spot.size()-1;i>0;i--){
		if(spot[i]==spot[i-1]){
			parent[i-1]=i-1;
			cnt=0;
			root[i-1]=cnt;
		}else{
			parent[i-1]=i;
			cnt++;
			root[i-1]=cnt;
		}
	}
	vector<int> re(spot.size());
	int r=0;
	rep(i,spot.size()){
		if(i!=0 && root[i-1]==0)r=0;
		re[i]=r;
		r++;
	}
	int maxnum=-1;
	string ans;
	rep(i,spot.size()){
		if(maxnum<re[i]){
			ans=spot[i];
			maxnum=re[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}