semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
 int m,i,a[5],s;
 scanf("%d",&m);
 for(i=4,s=0;i>=0;i--)
  if(m/(int)pow(10,i)!=0)
   {
    a[s]=m/(int)pow(10,i);
    m=m-a[s]*(int)pow(10,i);
    s++;
   }
 for(;s-1>=0;s--)
  printf("%d",a[s-1]);
 return 0;
}
int main()
{
	int n1,n2,n3,n4,n5,a;
	scanf("%d",&a);
	if(a>=10000)
	{
		n1=(int)(a/10000);
		n2=(int)((a-n1*10000)/1000);
		n3=(int)((a-n1*10000-n2*1000)/100);
		n4=(int)((a-n1*10000-n2*1000-n3*100)/10);
		n5=a-n1*10000-n2*1000-n3*100-n4*10;
		printf("%d%d%d%d%d\n",n5,n4,n3,n2,n1);
	}
	if(a<10000 && a>=1000)
	{
		n1=(int)(a/1000);
		n2=(int)((a-n1*1000)/100);
		n3=(int)((a-n1*1000-n2*100)/10);
		n4=a-n1*1000-n2*100-n3*10;
		printf("%d%d%d%d\n",n4,n3,n2,n1);
	}
	if(a<1000 && a>=100)
	{
		n1=(int)(a/100);
		n2=(int)((a-n1*100)/10);
		n3=a-n1*100-n2*10;
		printf("%d%d%d\n",n3,n2,n1);
	}
	if(a<100 && a>=10)
	{
		n1=(int)(a/10);
		n2=a-n1*10;
		printf("%d%d\n",n2,n1);
	}
	return 0;
}
int main()
{
	int shu,i,jieguo;
	scanf("%d",&shu);
	if(shu<10)
		printf("%d",shu);
	if(shu>=10&&shu<100)
	{
		jieguo=shu/10+(shu-shu/10*10)*10;
		printf("%d",jieguo);
	}
	if(shu>=100&&shu<1000)
	{
		jieguo=shu/100+(shu-shu/100*100)/10*10+((shu-shu/100*100)-(shu-shu/100*100)/10*10)*100;
		printf("%d",jieguo);
	}
	if(shu>=1000&&shu<10000)
	{
		jieguo=shu/1000+(shu-shu/1000*1000)/100*10+(shu-shu/100*100)/10*100+(shu-shu/10*10)*1000;
		printf("%d",jieguo);
	}
	if(shu>=10000&&shu<100000)
	{
		jieguo=shu/10000+(shu-shu/10000*10000)/1000*10+(shu-shu/1000*1000)/100*100+(shu-shu/100*100)/10*1000+(shu-shu/10*10)*10000;
		printf("%d",jieguo);
	}

}
void main()
{
	int x,a,b,c,d,e;
	scanf("%d",&x);
	if(x>9999)
	{a=x/10000;b=(x-a*10000)/1000;c=(x-a*10000-b*1000)/100;d=(x-a*10000-b*1000-c*100)/10;e=x-a*10000-b*1000-c*100-d*10;printf("%d",e*10000+d*1000+c*100+b*10+a);}
	else if(x>999)
		{a=x/1000;b=(x-a*1000)/100;c=(x-a*1000-b*100)/10;d=(x-a*1000-b*100-c*10);printf("%d",d*1000+c*100+b*10+a);}
	     else if(x>99)
			 {a=x/100;b=(x-a*100)/10;c=x-a*100-b*10;printf("%d",c*100+b*10+a);}
		      else if(x>9)
			  {a=x/10;b=x-a*10;printf("%d",b*10+a);}
}
void main()
{
	int n,a,b,c,d,e,m;
	scanf("%d",&n);
	if(n<10)
		printf("%d\n",n);
	else
	{
		if(n<100)
		{
		a=n/10;
		b=n%10;
	    m=a+b*10;
		printf("%d\n",m);
		}
		else
		{
			if(n<1000)
			{
		    a=n/100;
	  	    b=n/10-a*10;
		    c=n%10;
		    m=a+b*10+c*100;
		    printf("%d\n",m);
			}
			else
			{
				if(n<10000)
				{
					a=n/1000;
					b=n/100-a*10;
					c=n/10-a*100-b*10;
					d=n%10;
					m=a+b*10+c*100+d*1000;
					printf("%d\n",m);
				}
				else
				{
					a=n/10000;
					b=n/1000-a*10;
					c=n/100-a*100-b*10;
					d=n/10-a*1000-b*100-c*10;
					e=n%10;
                    m=a+b*10+c*100+d*1000+e*10000;
					printf("%d\n",m);
				}
			}
		}
	}
}
int main()                        
{
	int k,i=10,m,n,a;
    scanf("%d",&k);
		n=k;
		for(;;)
		{
			m=n%i;
			n=n/i;
			printf("%d",m);
			if(n==0) break;
		}
}
int main()
{
    int n,a=0,b=0,c=0,t;
    scanf("%d",&n);
    for(;n>0;)
    {
        t=n%10   ;
        printf("%d",t);
        n/=10;


     }


    return 0;
}
int main( ){
	int n,y;
	int t=0;
	
	scanf("%d",&n);
	if(n>10000){
		int i=4;
    for(int num=n;num>0;num/=10){
	y=pow(10,i);
	t=t+num%10*y;
	i=i-1;
	}
	}
	else if(n>1000){
	int i=3;
    for(int num=n;num>0;num/=10){
	y=pow(10,i);
	t=t+num%10*y;
	i=i-1;
	}
	}
		else if(n>100){
	int i=2;
    for(int num=n;num>0;num/=10){
	y=pow(10,i);
	t=t+num%10*y;
	i=i-1;
	}
		}
	else if(n>10){
	int i=1;
    for(int num=n;num>0;num/=10){
	y=pow(10,i);
	t=t+num%10*y;
	i=i-1;
	}
	}
	else if(n>1){
	t=n;
	}
	printf("%d",t);
	
	return 0;
}
int main()
{		
	char s[6];
	while(scanf("%s",s) != EOF)
	{
		int len = strlen(s);
		for(int i = len - 1;i >= 0;i--)
		{
			printf("%c",s[i]);
		}
		printf("\n");
	}
	return 0;
}
int main() 
{
	int n;
    scanf("%d",&n);
	int y=0;
	int z=0;
	for(int i=0;i<5;i++){        
        if(n/10!=0){			
			y = n%10;
			z= 10*z+10*y;
		}
		if(n/10==0){
			z +=n;
		}
        n = n/10;
	}
	printf("%d",z);
    return 0;
}
int main(int argc, char* argv[])
{   
	int a,a1,a2,a3,a4,a5;
	scanf("%d",&a);
	a5=a/10000;
    a4=(a-a5*10000)/1000;
	a3=(a-a5*10000-a4*1000)/100;
	a2=(a-a5*10000-a4*1000-a3*100)/10;
	a1=(a-a5*10000-a4*1000-a3*100-a2*10);
	if (a5!=0&&a4!=0&&a3!=0&&a2!=0&&a1!=0)
	{printf("%d%d%d%d%d",a1,a2,a3,a4,a5);}
	if (a5==0&&a4!=0&&a3!=0&&a2!=0&&a1!=0)
	{printf("%d%d%d%d",a1,a2,a3,a4);}
	else if (a5==0&&a4==0&&a3!=0&&a2!=0&&a1!=0)
	{printf("%d%d%d",a1,a2,a3);}
	else if (a5==0&&a4==0&&a3==0&&a2!=0&&a1!=0)
	{printf("%d%d",a1,a2);}
	else if (a5==0&&a4==0&&a3==0&&a2==0&&a1!=0)
	{printf("%d",a1);}

	return 0;
}
main()
{
	int a,b,c,d,e,x;
	scanf("%5d",&x);
	a=x/10000;
	b=x%10000/1000;
	c=x%1000/100;
	d=x%100/10;
	e=x%10;
	x=e*10000+d*1000+c*100+b*10+a;
loop:if(x%10==0)
	 {
		 x=x/10;
		 goto loop;
	 }
	 else printf("%d\n",x);
}
int main()
{
	int n,m,a,b,c,d,e;
	scanf("%d",&n);
	if(n>1000){
		a=n%10;
		b=(n%100-a)/10;
		c=(n%1000-a-10*b)/100;
		d=(n%10000-a-10*b-100*c)/1000;
		e=(n%100000-a-10*b-100*c-1000*d)/10000;
		m=a*10000+b*1000+c*100+d*10+e;
		printf("%d",m);}
	else if(n<1000){
		a=n%10;
		b=(n%100-a)/10;
		c=(n%1000-a-10*b)/100;
		m=a*100+b*10+c;
		printf("%d",m);}
	return 0;
}
void main()
{
	int a,b,c,d,e,f;
	scanf("%d\n",&a);
	b=a/10000;
	c=(a-10000*b)/1000;
	d=(a-10000*b-1000*c)/100;
	e=(a-10000*b-1000*c-100*d)/10;
	f=a-10000*b-1000*c-100*d-10*e;
	if(b!=0&&c!=0&&d!=0&&e!=0&&f!=0) printf("%d%d%d%d%d",f,e,d,c,b);
	else if(b==0&&c!=0&&d!=0&&e!=0&&f!=0) printf("%d%d%d%d",f,e,d,c);
	     else if(b==0&&c==0&&d!=0&&e!=0&&f!=0) printf("%d%d%d",f,e,d);
	          else if(b==0&&c==0&&d==0&&e!=0&&f!=0) printf("%d%d",f,e);
                   else if(b==0&&c==0&&d==0&&e==0&&f!=0) printf("%d",f);
}
void main()
{
	int n,a,b,c,d,e,sum;
	scanf("%d",&n);
	a=n%10;
	b=(n-a)/10;
	b=b%10;
	c=(n-b*10-a)/100;
	c=c%10;
    d=(n-c*100-b*10-a)/1000;
	d=d%10;
	e=(n-d*1000-c*100-b*10-a)/10000;
	e=e%10;
	if(b==0&&c==0&&d==0&&e==0)
	{
		sum=a;printf("%d",sum);
	}
	if(b!=0&&c==0&&d==0&&e==0)
	{	
		sum=a*10+b;
		printf("%d",sum);
	}
	if(b!=0&&c!=0&&d==0&&e==0)
	{
		sum=a*100+b*10+c;
		printf("%d",sum);
	}
	if(b!=0&&c!=0&&d!=0&&e==0)
	{
		sum=a*1000+b*100+c*10+d;
		printf("%d",sum);
	}
	if(b!=0&&c!=0&&d!=0&&e!=0)
	{
	sum=a*10000+b*1000+c*100+d*10+e;
		printf("%d",sum);
	}
}
void main()
{
   int i,n,a[5];
   char c,t,str[5];
   gets(str);
   n=0;
   for(i=0;(c=str[i])!='\0';i++)
      n=n+1; 
   for(i=0;i<n/2;i++)
    {
     t=str[i];
     str[i]=str[n-1-i];
     str[n-1-i]=t;
    }
     for(i=0;i<n;i++) printf("%c",str[i]);
}
int main()
{
  int n;
  scanf("%d",&n);
  int a=n/10;
  int b=n%10;
  int m=0;
  int t;
  while(a!=0){
  m=b*10;
  t=a;
  a=a/10;
  b=t%10;
  b+=m;
  }
  printf("%d\n",b);
  return 0;


}
void main()
{
	int d,a;
	scanf("%d",&d);
	if(d/10000)
		a=d%10*10000+d/10%10*1000+d/100%10*100+d/1000%10*10+d/10000;
	else if(d/1000)
		a=d%10*1000+d/10%10*100+d/100%10*10+d/1000;
	else if(d/100)
		a=d%10*100+d/10%10*10+d/100;
	else if(d/10)
		a=d%10*10+d/10;
	else 
		a=d;
	printf("%d",a);
}
int main ()
{
	int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;
	scanf("%d",&a);
	if(a/10==0)
	{
		printf("%d",a);
	}
	else if(a/100==0)
	{
		b=a/10;
		c=a-10*b;
		d=b+c*10;
		printf("%d",d);
	}
	else if(a/1000==0)
	{
		e=a/100;
		f=(a-100*e)/10;
		g=a-100*e-10*f;
		h=g*100+f*10+e;
		printf("%d",h);
	}
	else if(a/10000==0)
	{
		i=a/1000;
		j=(a-1000*i)/100;
		k=(a-1000*i-100*j)/10;
		l=a-1000*i-100*j-10*k;
		m=l*1000+k*100+j*10+i;
		printf("%d",m);
	}
	else
	{
		n=a/10000;
		o=(a-10000*n)/1000;
		p=(a-10000*n-1000*o)/100;
		q=(a-10000*n-1000*o-100*p)/10;
		r=a-10000*n-1000*o-100*p-10*q;
		s=10000*r+1000*q+100*p+10*o+n;
		printf("%d",s);
	}
	return 0;
}
main()
{
	int n,a,b,c,d,e;
	scanf("%ld",&n);
	a=n/10000;
	b=(n-a*10000)/1000;
	c=(n-a*10000-b*1000)/100;
	d=(n-a*10000-b*1000-c*100)/10;
	e=n-a*10000-b*1000-c*100-d*10;
	if(e!=0) printf("%d",e);
	if(d!=0) printf("%d",d);
	if(c!=0) printf("%d",c);
	if(b!=0) printf("%d",b);
	if(a!=0) printf("%d",a);
}
int main()
{
	int n,i,j,a[7],b[7],c=0;
	scanf("%d",&n);
	a[0]=0;
	a[1]=n/10000;
	a[2]=(n-a[1]*10000)/1000;
	a[3]=(n-a[1]*10000-a[2]*1000)/100;
	a[4]=(n-a[1]*10000-a[2]*1000-100*a[3])/10;
	a[5]=n-a[1]*10000-a[2]*1000-100*a[3]-10*a[4];
	for(j=0;j<=5;j++)
	{
		if(a[j]==0)
		{
			if(a[j-1]==0)
			{
				continue;
			}
			else
			{
			    b[5-j]=a[j];
			}
		}
		else
		{
			 b[5-j]=a[j];
			 c+=1;
		}
	}
	for(i=0;i<c;i++)
	{
		printf("%d",b[i]);
	}
	return 0;
}
int main()
{
	int n,i,a[5]={0};
	scanf("%d",&n);
	for(i=0;i<5;i++)
	{
		a[i]=n%10;
		n=n/10;
		if(n==0)
			break;
	}
	for(i=0;i<5;i++)
	{
		if(a[i]==0)
		    break;
		printf("%d",a[i]);
	}
	return 0;
}
main()
{
	int i,j,n,s,t,r,l;
	char a[51][1000];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{ gets(a[i]);
	  l=strlen(a[i]);
	  if (a[i][l-1]=='r') {for(j=0;j<l-2;j++) printf("%c",a[i][j]);}
	  else if (a[i][l-1]=='y') {for(j=0;j<l-2;j++) printf("%c",a[i][j]);}
	  else if (a[i][l-1]=='g') {for(j=0;j<l-3;j++) printf("%c",a[i][j]);}
	 printf("\n");
	}
}
int main(int argc, char* argv[])
{
	int n,i,j,len;
	char s[255];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s);
		len=strlen(s);
			if(s[len-1]=='r'&&s[len-2]=='e'||s[len-1]=='y'&&s[len-2]=='l')
			{
				for(j=0;j<(len-2);j++)
					printf("%c",s[j]);
			}
			else if(s[len-1]=='g'&&s[len-2]=='n'&&s[len-3]=='i')
			{
                for(j=0;j<(len-3);j++)
                    	printf("%c",s[j]);
			}
			else 
			{
				 for(j=0;j<len;j++)
				printf("%c",s[j]);
			}
			printf("\n");
	}
	return 0;
}
void main()
{
	char a[50][20],b[50];
	int n,i,j,c;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
		scanf("%s",a[i]);
	for(i=0;i<n;i++)
		b[i]=strlen(a[i]);
	for(i=0;i<n;i++)
	{
		c=b[i];
		if(a[i][c-1]=='g')
		{a[i][c-1]='\0';
            a[i][c-2]='\0';
			a[i][c-3]='\0';
		}
        else
		{
			a[i][c-1]='\0';
		    a[i][c-2]='\0';
		}
		printf("%s\n",a[i]);
	}
}
int main(){
    int n;
    char word[33];
    scanf("%d",&n);
    for (int i=0;i<n;i++){
         scanf("%s",word);
         if(word[strlen(word)-2]=='e'&&
            word[strlen(word)-1]=='r'){
                  word[strlen(word)-2]='\0';
                  printf("%s\n",word);
         }
         if(word[strlen(word)-2]=='l'&&
            word[strlen(word)-1]=='y'){
                  word[strlen(word)-2]='\0';
                  printf("%s\n",word);
         }
         if(word[strlen(word)-3]=='i'&&
            word[strlen(word)-2]=='n'&&
            word[strlen(word)-1]=='g'){
                  word[strlen(word)-3]='\0';
                  printf("%s\n",word);
         }
    }
return 0;
}
int main(){
	int i,j,k,l,n;
	char w[33];
	char t[33][33];
	gets(w);
	n=atoi(w);
	for(i=0;i<n;i++){
		gets(t[i]);
	}
	for(i=0;i<n;i++){
		l=strlen(t[i]);
		if(t[i][l-1]=='g'&&t[i][l-2]=='n'&&t[i][l-3]=='i'){
			t[i][l-3]='\0';
		}
		else if(t[i][l-1]=='r'&&t[i][l-2]=='e'){
			t[i][l-2]='\0';
		}
		else if(t[i][l-1]=='y'&&t[i][l-2]=='l'){
		    t[i][l-2]='\0';
		}
	}
	for(i=0;i<n;i++){
		puts(t[i]);
	}
	return 0;
}
void main()
{
	char a[30];
	int n,i;
	char de(char a[30]);
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
	 scanf("%s",a);
	 int m;
	 m=strlen(a);
	 if(a[m-1]=='y'&&a[m-2]=='l')
	 {a[m-2]='\0';printf("%s\n",a);}
	 else if(a[m-1]=='g'&&a[m-2]=='n'&&a[m-3]=='i')
	 {a[m-3]='\0';printf("%s\n",a);}
	 else if (a[m-1]=='r'&&a[m-2]=='e')
	 {	a[m-2]='\0';printf("%s\n",a);}
	}
	
}
int main(){
	int n,len,i,k;
	char c[M];
	scanf("%d",&n);

	for(k=0;k<n+1;k++){
		gets(c);

	    len=strlen(c);
        if(c[len-2]=='e'){
			c[len-2]='\0';
			printf("%s\n",c);
		}else
        if(c[len-2]=='l'){
			c[len-2]='\0';
			printf("%s\n",c);
		}else
        if(c[len-3]=='i'){
			c[len-3]='\0';
			printf("%s\n",c);
		}
	}

	return 0;
}
int main()
{
	void crea(char c[]);
	int n,i;
	char a[100][20];

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s",a[i]);
	}
	for(i=0;i<n;i++)
	{
		crea(a[i]);
		printf("%s\n",a[i]);
	}
	return 0;
}

void crea(char c[])
{
	int x;
	if(c[(int)strlen(c)-1]=='r') x=0;
	else if(c[(int)strlen(c)-1]=='y') x=1;
	else if(c[(int)strlen(c)-1]=='g') x=2;
	switch(x)
	{
	case 0:c[(int)strlen(c)-1]='\0';c[(int)strlen(c)-1]='\0';break;
	case 1:c[(int)strlen(c)-1]='\0';c[(int)strlen(c)-1]='\0';break;
	case 2:c[(int)strlen(c)-1]='\0';c[(int)strlen(c)-1]='\0';c[(int)strlen(c)-1]='\0';break;
	}
}
int main ()
{
	char zfc[100][50],gaiguo[100][50];
	int n,l[100];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s",zfc[i]);
		l[i]=strlen(zfc[i]);
		if(zfc[i][l[i]-3]=='i' && zfc[i][l[i]-2]=='n' && zfc[i][l[i]-1]=='g'){
			strncpy(gaiguo[i],zfc[i],l[i]-3);
			
		}else if(zfc[i][l[i]-2]=='e' && zfc[i][l[i]-1]=='r'){
			strncpy(gaiguo[i],zfc[i],l[i]-2);
			
		}else if(zfc[i][l[i]-2]=='l' && zfc[i][l[i]-1]=='y'){
			strncpy(gaiguo[i],zfc[i],l[i]-2);
			
		}
	}
	for(int j=0;j<n;j++){
		printf("%s\n",gaiguo[j]);
	}
    return 0;
}
main()
{
	int m,i,j,k;
	char p[51][100]={0};
	scanf("%d",&m);
	for (i=0;i<m;i++)
	{
		scanf("%s",p[i]);
		j=strlen(p[i]);
		if (p[i][j-1]=='g')
		{
			p[i][j-1]=0;
			p[i][j-2]=0;
			p[i][j-3]=0;
		}
		if (p[i][j-1]=='r')
		{
			p[i][j-1]=0;
			p[i][j-2]=0;
		}
		if (p[i][j-1]=='y')
		{
			p[i][j-1]=0;
			p[i][j-2]=0;
		}
	}
	for (i=0;i<m;i++)
	     printf("%s\n",p[i]);
}
int main()
{
	char word[20],newword[20];
	int i,j,len,n;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",word);
		len=strlen(word);
		if(word[len-3]=='i'&& word[len-2]=='n'&& word[len-1]=='g')
		{
		   for (j=0;j<len-3;j++)
		   {
              newword[j]=word[j];
		   }
		   newword[j]='\0';
		}
		else 
		{
			 for (j=0;j<len-2;j++)
			 {
                newword[j]=word[j];
			 }
		     newword[j]='\0';
		
		}
		printf("%s\n",newword);
	}
	return 0;
}
int main(){
int n,i,j;
scanf("%d",&n);
char zfc[50][33];
for(i=0;i<n;i++){
scanf("%s",zfc[i]);
}
for(i=0;i<n;i++){
int len=0;
len=strlen(zfc[i]);
for(j=0;j<len-3;j++){
printf("%c",zfc[i][j]);
}
if(zfc[i][len-3]=='i'&&zfc[i][len-2]=='n'&&zfc[i][len-1]=='g'){
printf("\n");
   }
if((zfc[i][len-2]=='e'&&zfc[i][len-1]=='r')||(zfc[i][len-2]=='l'&&zfc[i][len-1]=='y')){
    printf("%c\n",zfc[i][len-3]);
}
else{
printf("\n");
}
}
  
    return 0;
}
void main()
{
	int t,n,i,j;
	char a[100][10];
	scanf("%d",&t);
	for(i=0;i<t;i++)
		scanf("%s",a[i]);
		for(i=0;i<t;i++)
		{
			n=strlen(a[i]);
		if((a[i][n-2]=='e' && a[i][n-1]=='r') || (a[i][n-2]=='l' && a[i][n-1]=='y'))
		{
			for(j=0;j<n-2;j++)
				printf("%c",a[i][j]);
		}
		if(a[i][n-3]=='i' && a[i][n-2]=='n' && a[i][n-1]=='g')
		{
			for(j=0;j<n-3;j++)
				printf("%c",a[i][j]);
		}
		printf("\n");
		}
		
}
int main()
{
    int n,i;
    char s[50][10];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%s",s[i]);
    for(i=0;i<n;i++)
    {if(s[i][strlen(s[i])-2]=='e'||s[i][strlen(s[i])-2]=='l')
      s[i][strlen(s[i])-2]='\0';
     else  s[i][strlen(s[i])-3]='\0';}
     for(i=0;i<n;i++)
     printf("%s\n",s[i]);
	 return 0;
}
int main()
{
 char word[50];
 int n,l;
 scanf("%d", &n);
 for(int i=0; i<n; i++)
 {
  scanf("%s", word);
      l=strlen(word);
     if ((word[l-1]=='r')||(word[l-1]=='y'))
  l=l-2;
  else l=l-3;
     for(int j=0; j<l; j++){
   printf("%c", word[j]);}
  printf("\n");
 }
 return 0;
}
int main (){
    int n,i,j,l;
    char s[300];
    scanf("%d",&n);
    for (i=0; i<n; i++)
      {
          scanf("%s",s);
          l=strlen(s);
          if (s[l-1]=='r') s[l-2]=0;
          if (s[l-1]=='g') s[l-3]=0;
          if (s[l-1]=='y') s[l-2]=0;
          puts(s);
          
      }
      return 0;
}
int main(int argc, char* argv[])
{
	int n, wlong;
	char word[32], *p;
	scanf("%d", &n);
	for(int i=0; i<n; i++){
		scanf("%s", word);
		for(p=word; *p; p++);
		switch(*(p-1)){
		case 'r' : wlong=2; break;
		case 'y' : wlong=2; break;
        case 'g' : wlong=3; break;
		}
		*(p-wlong)='\0';
		printf("%s\n", word);
	}
	return 0;}
int main()
{
	int n,i,j,p,len;
	char str[20];
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		scanf("%s",str);
		len=strlen(str);
		if((str[len-1]=='r')&&(str[len-2]=='e')||(str[len-1]=='y')&&(str[len-2]=='l'))
		{
			for(j=0;j<len-2;j++)
				printf("%c",str[j]);
			printf("\n");
		}
		if((str[len-3]=='i')&&(str[len-2]=='n')&&(str[len-1]=='g'))
		{
			for(p=0;p<len-3;p++)
				printf("%c",str[p]);
			printf("\n");
		}
	}
	return 0;
}
int main()
{
    int i,n;
	char word[50][32],j;
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		gets(word[i]);
        strlen(word[i]);
		j=strlen(word[i]);
		if(j>2&&word[i][j-2]=='e'&&word[i][j-1]=='r')
		{
			word[i][j-2]='\0';
		}
		else if(j>2&&word[i][j-2]=='l'&&word[i][j-1]=='y')
		{
			word[i][j-2]='\0';
		}
		else if(j>3&&word[i][j-3]=='i'&&word[i][j-2]=='n'&&word[i][j-1]=='g')
		{
			word[i][j-3]='\0';
		}     
	}
	for(i=0;i<=n;i++)
	{
	    printf("%s\n",word[i]);
	}
	return 0;
}
void delete3(char t[],int length);
void delete2(char t[],int length);

void main()
{
	char word[50][30];
	int n;
	int i,j;
	int length;

	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",word[i]);
	}
	for (i=0;i<n;i++)
	{
		length=strlen(word[i]);
		if (word[i][length-1]=='g')
			delete3(word[i],length);
		else
			delete2(word[i],length);
		printf("%s",word[i]);
		if (i!=n-1)
			printf("\n");
	}
}


void delete3(char t[],int length)
{
	t[length-3]='\0';
}

void delete2(char t[],int length)
{
	t[length-2]='\0';
}
int main()
{
	char a[2]={'e','r'},b[2]={'l','y'},c[3]={'i','n','g'};
	char s[20];
	int n,m,j,co;
	scanf("%d",&n);
	for(m=0;m<n;m++)
	{
		scanf("%s",s);
        co=strlen(s);
		if((s[co-2]==a[0]&&s[co-1]==a[1])||(s[co-2]==b[0]&&s[co-1]==b[1]))
		{
			for(j=0;j<co-2;j++)
				printf("%c",s[j]);
		}
		if(s[co-3]==c[0]&&s[co-2]==c[1]&&s[co-1]==c[2])
		{
			for(j=0;j<co-3;j++)
                printf("%c",s[j]);
		}
		printf("\n");
	}
	return 0;
}
int main()
{
	int n,i,j;
	char a[50][33];
	cin >> n;
	cin.ignore ();
	for(i=0 ; i< n ; i++)
		cin >> a[i];
	for(i=0 ; i< n ; i++)
	{
		j = strlen(a[i]);
		if(a[i][j-2] == 'e')
		{
			if(a[i][j-1] == 'r')
				a[i][j-2] = '\0';
		}
		if(a[i][j-2] == 'l')
		{
			if(a[i][j-1] == 'y')
				a[i][j-2] = '\0';
		}
		if(a[i][j-3] == 'i')
		{
			if(a[i][j-2] == 'n' &&
				a[i][j-1] == 'g')
				a[i][j-3] = '\0';
		}
		cout<<a[i]<<endl;
	}
	return 0;
}
int main()
{
int i,j;
int n,l;
 char word[50];
 scanf("%d", &n);
 for(i=0; i<n; i++)
 {
  scanf("%s", word);
      l=strlen(word);
     if ((word[l-1]=='r')||(word[l-1]=='y'))
  l=l-2;
  else l=l-3;
     for(j=0; j<l; j++)
   printf("%c", word[j]);
  printf("\n");
 }
 return 0;
}
int main()
{
	int i,n,l[50];
	char s[50][20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	   scanf("%s",s[i]);
	   l[i]=strlen(s[i]);
	}
	for(i=0;i<n;i++)
	{
		if(s[i][l[i]-2]=='e'&&s[i][l[i]-1]=='r')
		{
			s[i][l[i]-2]='\0';
			s[i][l[i]-1]='\0';
		}
		else if(s[i][l[i]-2]=='l'&&s[i][l[i]-1]=='y')
		{
			s[i][l[i]-2]='\0';
			s[i][l[i]-1]='\0';
		}
		else if(s[i][l[i]-2]=='n'&&s[i][l[i]-1]=='g'&&s[i][l[i]-3]=='i')
		{
			s[i][l[i]-2]='\0';
			s[i][l[i]-1]='\0';
			s[i][l[i]-3]='\0';
		}
		printf("%s\n",s[i]);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	char s[50],S[50];
	int i,j;
	for(i=0;i<n;i++)
	{
		scanf("%s",s);
		for(j=0;s[j]!='\0';j++)
		{
			if ((s[j]=='e'&&s[j+1]=='r'&&s[j+2]=='\0')||
				(s[j]=='l'&&s[j+1]=='y'&&s[j+2]=='\0')||
				(s[j]=='i'&&s[j+1]=='n'&&s[j+2]=='g'&&s[j+3]=='\0'))
			{
				S[j]='\0';
			}
			else
			{
				S[j]=s[j];
			}
		}
		printf("%s\n",S);
	}


	return 0;
}
void main()
{
   int n;
   scanf("%d",&n);
   char i,in[55][20];
   int j,k;
   for(i=1;i<=n+1;i++)
   {
	   gets(in[i]);
	   k=strlen(in[i]);
	   if(in[i][k-1]=='r'){for(j=0;j<k-2;j++){printf("%c",in[i][j]);}if(j==k-2)printf("\n");}
	   if(in[i][k-1]=='y'){for(j=0;j<k-2;j++){printf("%c",in[i][j]);}if(j==k-2)printf("\n");}
	   if(in[i][k-1]=='g'){for(j=0;j<k-3;j++){printf("%c",in[i][j]);}if(j==k-3)printf("\n");}
   
   }
   
   
}
int main(){
	int n,i,j;
	char zfc[33];
	scanf("%d",&n);
    for(i=0;i<n;i++){
		scanf("%s",zfc);
		for(j=0;zfc[j]!='\0';j++){
			if(zfc[j+1]=='\0'){
				if(zfc[j]=='r')
					zfc[j-1]='\0';
				else if(zfc[j]=='g')
					zfc[j-2]='\0';
				else if(zfc[j]=='y')
					zfc[j-1]='\0';
			}
		}
		printf("%s\n",zfc);

		

	}




return 0;
}
int main(int argc, char* argv[])
{   int n,i;
    scanf("%d",&n);
	for(i=0;i<n;i++){
		char s[100];
		int k;
		scanf("%s",s);
		k=strlen(s);
		char s1[4],s2[3];
		s1[0]=s[k-3];s1[1]=s[k-2];s1[2]=s[k-1];s1[3]='\0';
		s2[0]=s[k-2];s2[1]=s[k-1];s2[2]='\0';
		if(strcmp(s1,"ing")==0){
			char s3[100];
			int j;
			for(j=0;j<k-3;j++){
				s3[j]=s[j];
			}
			s3[k-3]='\0';
			printf("%s\n",s3);
		}
		else if((strcmp(s2,"ly")==0)||(strcmp(s2,"er")==0)){
			char s4[100];
			int h;
			for(h=0;h<k-2;h++){
				s4[h]=s[h];
			}
			s4[k-2]='\0';
			printf("%s\n",s4);
		}
	}
	return 0;
}
int main()
{
	int n,i;
	scanf ("%d",&n);
	for(i=0;i<n;i++){
	int c=0;
	char str[15]={0},string[15]={0};
		scanf("%s",&str);
		c=strlen(str);
		if(str[c-1]=='g'){
		strncpy(string,str,c-3);
		}
		else{
			strncpy(string ,str,c-2);
		}
		printf("%s\n",string);
		}

		return 0;
}
void main()
{
	char str[20],t[20];
	int len,i,n,j;
	scanf("%d",&n);
	for(j=0;j<n;j++){
		scanf("%s",str);
		len = strlen(str);
		if(str[len-1]=='r'){
			for(i=0;i<len-2;i++){
				t[i] = str[i];
			}
			t[i] = '\0';
		}
		if(str[len-1]=='g'){
			for(i=0;i<len-3;i++){
				t[i] = str[i];
			}
			t[i] = '\0';
		}
		if(str[len-1]=='y'){
			for(i=0;i<len-2;i++){
				t[i] = str[i];
			}
			t[i] = '\0';
		}
		printf("%s\n",t);
	}
	
}
void main()
{
 char word1[50][20],word2[50][20];
 int i,n,j,l[50];
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%s",word1[i]);
  l[i]=strlen(word1[i]); 
 }
 for(i=0;i<n;i++)
 {
  if(word1[i][l[i]-2]=='e'&&word1[i][l[i]-1]=='r')
  {
   for(j=0;j<l[i]-2;j++)
   {
    word2[i][j]=word1[i][j];
   }
    word2[i][j]='\0';
  }
  else if(word1[i][l[i]-1]=='g'&&word1[i][l[i]-2]=='n'&&word1[i][l[i]-3]=='i')
  {
   for(j=0;j<l[i]-3;j++)
   word2[i][j]=word1[i][j];
   word2[i][j]='\0';
  }
  else if(word1[i][l[i]-2]=='l'&&word1[i][l[i]-1]=='y')
  {
   for(j=0;j<l[i]-2;j++)
   {
    word2[i][j]=word1[i][j];
   }
   word2[i][j]='\0';
  }
 }
 for(i=0;i<n;i++)
 {
  printf("%s",word2[i]);
  printf("\n");
 }
}
int main(){
   char a[100]={0},b[100]={0};
   int n,i,j,l,k,t;
   scanf("%d",&n);
   for(t=0;t<n;t++){
        scanf("%s",a);
        l=strlen(a);
        for(i=0;i<l;i++){
            b[i]=a[l-1-i];
            }
        if(b[0]=='r'&&b[1]=='e'||b[0]=='y'&&b[1]=='l'){
            for(i=l-1;i>1;i--){
                printf("%c",b[i]);
                }              
            }
        else if(b[0]=='g'&&b[1]=='n'&&b[2]=='i'){
            for(i=l-1;i>2;i--){
                printf("%c",b[i]);
                }             
            }
        printf("\n");
        }
    
    scanf("%d",&i);
    return 0;
    }
int main()
{
	int n,i,j,l[50];
	char str[50][50],t[50][50];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	scanf("%s",str[i]);
	l[i]=strlen(str[i]);
	
	if(str[i][l[i]-1]=='r')
	{
	for(j=0;j<l[i]-2;j++)
	t[i][j]=str[i][j];
	}
	t[i][l[i]-1]='\0';
	
	if(str[i][l[i]-1]=='g')
{
	for(j=0;j<l[i]-3;j++)
	t[i][j]=str[i][j];
	}
	t[i][l[i]-2]='\0';
	if(str[i][l[i]-1]=='y')
	{
	for(j=0;j<l[i]-2;j++)
	t[i][j]=str[i][j];
	}t[i][l[i]-1]='\0';}
	for(i=0;i<n;i++)
	{printf("%s\n",t[i]);}
		return 0;
}
int main()

{
int n,i,j;
    scanf("%d",&n);
char*lab=(char*)malloc(n*32*sizeof(char));
for(i=0;i<n;i++)
    scanf("%s",lab+i*32);
for(i=0;i<n;i++)
{

    for(j=0;*(lab+32*i+j)!='\0';j++)
        {
    if(strcmp(lab+32*i+j,"er")==0||strcmp(lab+32*i+j,"ly")==0||strcmp(lab+32*i+j,"ing")==0)
    {*(lab+32*i+j)='\0';break;}
        }}
for(i=0;i<n;i++) puts(lab+32*i);
return 0;
}
int main()
{
    int n,i,m,j,p,q,t;
    scanf("%d",&n);
    char A[20],a[3]="er",b[3]="ly",c[4]="ing",d[3],e[4];
    for(i=0;i<n;i++)
    {
        scanf("%s",&A);
        m=strlen(A);
        d[0]=A[m-2];
        d[1]=A[m-1];
        d[2]='\0';
        e[0]=A[m-3];
        e[1]=A[m-2];
        e[2]=A[m-1];
        e[3]='\0';
        p=strcmp(d,a);
        q=strcmp(d,b);
        t=strcmp(e,c);
        if(p==0||q==0)
        {
            A[m-2]='\0';
            printf("%s\n",A);
        }
         else if(t==0)
        {
             A[m-3]='\0';
            printf("%s\n",A);
        }
        else{printf("%s\n",A);}
        for(j=0;j<20;j++)
        {  A[j]=0;}


    }
    return 0;

}