semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
	int n,i,j,b[50];
	char a[50][33];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",a[i]);
		b[i]=strlen(a[i]);
	}
	for(i=0;i<n;i++){
		if(a[i][b[i]-1]=='r'){
			a[i][b[i]-2]='\0';
		}else if(a[i][b[i]-1]=='g'){
			a[i][b[i]-3]='\0';
		}else if(a[i][b[i]-1]=='y'){
			a[i][b[i]-2]='\0';
		}
	}
    for(i=0;i<n;i++){
		printf("%s\n",a[i]);
	}
	return 0;
}
void delsuffix(char main[],int m)
{
	main[strlen(main)-m]='\0';
}
int check(char main[],int len1,char suffix[],int len2)
{
	int n=len1-1,m=len2-1;
	while(m>=0&&main[n]==suffix[m])
	{
		m--;
		n--;
	}
	if(m>=0)
		return 0;
	else
		return 1;
}
void main()
{
	int number,i,lensuffix[3]={2,2,3};
	char s[30],suffix[3][4]={"er","ly","ing"};
	scanf("%d",&number);
	for(i=1;i<=number+1;i++)
	{
		gets(s);
		int m;
		for(m=0;m<3;m++)
		{
			if(check(s,strlen(s),suffix[m],lensuffix[m]))
			{
				delsuffix(s,lensuffix[m]);
				printf("%s\n",s);
				break;
			}
		}
	}
}
void main()
{
	int i,j,l,n;
	char str[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str);
			l=strlen(str);
		if(str[l-2]=='e')
			for(j=0;j<l-2;j++)
				printf("%c",str[j]);
				if(str[l-2]=='l')
			for(j=0;j<l-2;j++)
					printf("%c",str[j]);
				if(str[l-3]=='i')
			for(j=0;j<l-3;j++)
				printf("%c",str[j]);
printf("\n");

		}
	}
int main()
{
	char *p,a[100];
	int n,l;
	scanf("%d",&n);
	for(int j=0;j<n;j++)
	{
	scanf("%s",a);
		p=a;
		l=strlen(a);
		if(strcmp("er",(p+l-2))==0){*(p+l-2)='\0';puts(p);}
		if(strcmp("ly",(p+l-2))==0){*(p+l-2)='\0';puts(p);}
		if(strcmp("ing",(p+l-3))==0){*(p+l-3)='\0';puts(p);}
	}

	return 0;
}
int main(){
	int i,j,n,m;
	char zfc[50][33];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",zfc[i]);
	for(i=0;i<n;i++){
		for(j=0;zfc[i][j]!='\0';j++){
			m=strlen(zfc[i]);
			if(strcmp(&zfc[i][m-2],"er")==0){
				zfc[i][m-2]='\0';
			}
			else if(strcmp(&zfc[i][m-2],"ly")==0){
				zfc[i][m-2]='\0';
			}
			else if(strcmp(&zfc[i][m-3],"ing")==0){
				zfc[i][m-3]='\0';
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%s\n",zfc[i]);
	}
	return 0;
}
void main()
{   
	int n,i,k;
	char c[32]="\0";
    scanf("%d",&n);
	for(i=1;i<=n;i++)
	{   
		
		scanf("%s",c);
		char o[32]="\0";
		k=strlen(c);char v[32]="\0";
		strncpy(v,c,k-3); strcat(v,"ing"); 
		if(strcmp(v,c)==0) {strncpy(o,c,k-3);printf("%s\n",o);}
		else {strncpy(o,c,k-2);printf("%s\n",o);}
    }
}
void main()
{
    int m,i,j,n,l;
	char a[100];
	scanf("%d",&m);
	for(j=1;j<=m;j++)
	{
		scanf("%s",a);
     l=strlen(a)-1;
		if(a[l]=='r')
		{
			for(n=0;n<l-1;n++)
			{
                printf("%c",a[n]);
			}printf("\n");
		}
        if(a[l]=='y')
		{
			for(n=0;n<l-1;n++)
			{
                printf("%c",a[n]);
			}printf("\n");
		}
		if(a[l]=='g')
		{
			for(n=0;n<l-2;n++)
			{
                printf("%c",a[n]);
			}printf("\n");
		}
	
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	getchar();
	char a[50][10000];
	int i;
	for(i=0;i<n;i++)
	{
		gets(a[i]);
	}
	for(i=0;i<n;i++)
	{
		int j;
		int len=strlen(a[i]);
		if(a[i][len-2]=='e' && a[i][len-1]=='r' || a[i][len-2]=='l' && a[i][len-1]=='y')
		{
			for(j=0;j<len-2;j++)
				putchar(a[i][j]);
		}
		if(a[i][len-3]=='i' && a[i][len-2]=='n' && a[i][len-1]=='g' )
		{
			for(j=0;j<len-3;j++)
				putchar(a[i][j]);
		}
		printf("\n");
	}
	return 0;
}
int main(){
    int n;
    char s[40];
    char local[3][5] = {
         "er", "ly", "ing"
         }; 
    char res[40];
    scanf("%d", &n);
    
    while(n--){
        
         scanf("%s", s);
         int len = strlen(s);
         if(len > 2 && strcmp(s + len - 2, local[0]) == 0){
                for(int i = 0; i < len - 2; ++i){
                        printf("%c", s[i]);
                }
                printf("\n");
         }
         else if(len > 2 && strcmp(s + len - 2, local[1]) == 0){
              for(int i = 0; i < len - 2; ++i){
                        printf("%c", s[i]);
                }
                printf("\n");
         }
         else if(len > 3 && strcmp(s + len - 3, local[2]) == 0){
              for(int i = 0; i < len - 3; ++i){
                        printf("%c", s[i]);
                }
                printf("\n");
         }
         else{
              printf("%s\n", s);
         }
    }
    
}
int main()
{
    char word[50][50],t1,t2;
    int n,i,l;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%s",word[i]);
    for(i=0;i<n;i++)
    {
        l=strlen(word[i]);
        if(word[i][l-1]=='r'&&word[i][l-2]=='e')
        {    
            word[i][l-1]='\0';
            word[i][l-2]='\0';
        }
        else if(word[i][l-1]=='y'&&word[i][l-2]=='l')
        {    
            word[i][l-1]='\0';
            word[i][l-2]='\0';
        }
        else if(word[i][l-1]=='g'&&word[i][l-2]=='n'&&word[i][l-3]=='i')
        {
            word[i][l-1]='\0';
            word[i][l-2]='\0';
            word[i][l-3]='\0';
        }
        printf("%s\n",word[i]);
    }
    return(0);
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n+1;i++)
	{
		char s[100],*p;
		gets(s);
		int k=0;
		for(p=s;*p!='\0';p++)
			k++;
		if(s[k-2]=='e'&&s[k-1]=='r')
		{
			for(int j=0;j<k-3;j++){
				printf("%c",s[j]);}
			printf("%c\n",s[k-3]);
		}
		else {if(s[k-2]=='l'&&s[k-1]=='y')
		{
			for(int j=0;j<k-3;j++){
				printf("%c",s[j]);}
			printf("%c\n",s[k-3]);
		}
		else {if(s[k-3]=='i'&&s[k-2]=='n'&&s[k-1]=='g')
		{
			for(int j=0;j<k-4;j++){
				printf("%c",s[j]);}
			printf("%c\n",s[k-4]);
		}
		else
		{
			for(int j=0;j<k;j++)
				printf("%c",s[j]);
		}}}
	}
	return 0;
}
void main()
{
	int n,i=1,j,len;
	char a[100]={0};
	scanf("%d",&n);
	while(i<=n+1)
	{
		gets(a);
		len=strlen(a);
		if((a[len-1]=='r'&&a[len-2]=='e')||(a[len-1]=='y'&&a[len-2]=='l'))
		{
		for(j=0;j<=len-3;j++)
		printf("%c",a[j]);
		printf("\n");
		}
		if(a[len-3]=='i'&&a[len-2]=='n'&&a[len-1]=='g')
		{
			for(j=0;j<=len-4;j++)
			printf("%c",a[j]);
			printf("\n");
		}
		i++;
	}
}
void main()
{
	int n,i,j,length;
	char a[100];

	scanf("%d",&n);
	for(j=1;j<=n+1;j++)
	{
		gets(a);
		length=strlen(a);
		if(a[length-3]=='i'&&a[length-2]=='n'&&a[length-1]=='g')
		{
			for(i=0;i<=length-4;i++)
				printf("%c",a[i]);
		        printf("\n");
		}
		else
		{
			for(i=0;i<=length-3;i++)
				printf("%c",a[i]);
		        printf("\n");
		}
	}
}
int main()
{
    char sz[100];
    int n,en;
    scanf("%d",&n);
    for(int i=0;i<=n;i++)
    {
            gets(sz);
            en=strlen(sz);
            switch(sz[en-1])
            {
                            case 'g':
                                 for(int j=0;j<en-4;j++)
                                 printf("%c",sz[j]);
                                 printf("%c\n",sz[en-4]);
                                 break;
                             case 'r':
                                 for(int j=0;j<en-3;j++)
                                 printf("%c",sz[j]);
                                 printf("%c\n",sz[en-3]);
                                 break;
                             case 'y':
                                 for(int j=0;j<en-3;j++)
                                 printf("%c",sz[j]);
                                 printf("%c\n",sz[en-3]);
                                 break;
            }
    }scanf("%d",&n);
            return 0;
}
int main(){
	int n,i,j,k,l;
	char z[50][max];
	char a;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",z[i]);
	}
	for(i=0;i<n;i++){
		l=strlen(z[i]);
		for(k=0,j=l-1;k<=j;k++,j--){
			a=z[i][k];
			z[i][k]=z[i][j];
			z[i][j]=a;
		}
	}
	for(i=0;i<n;i++){
		if(z[i][0]=='r'){
			z[i][1]='_';
		}else{
			if(z[i][0]=='y'){
				z[i][1]='_';
			}else{
				z[i][2]='_';
			}
		}
	}
	for(i=0;i<n;i++){
		l=strlen(z[i]);
		for(k=0,j=l-1;k<=j;k++,j--){
			a=z[i][k];
			z[i][k]=z[i][j];
			z[i][j]=a;
		}
	}
	for(i=0;i<n;i++){
		l=strlen(z[i]);
		for(j=0;j<l;j++){
			if(z[i][j]=='_'){
				z[i][j]='\0';
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%s\n",z[i]);
	}
	return 0;
}
int main(){
    int n,i,k,m;
    char a[50][33],b[50][33];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",a[i]);
       k=strlen(a[i]);
       if(a[i][k-1]=='r'||a[i][k-1]=='y'){
         for(m=0;m<k-2;m++){
         b[i][m]=a[i][m];
         }
         b[i][k-2]='\0';
       }
       else if(a[i][k-1]=='g'){
           for(m=0;m<k-3;m++){
               b[i][m]=a[i][m];
           }
           b[i][k-3]='\0';
       }
       printf("%s\n",b[i]);
    }
    return 0;
}
int main()
{
    char s[50][32],w[50][32]={"\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0","\0"};
    int n,i,l;
    scanf("%d\n",&n);
    for(i=0;i<=n-1;i++)
    {
      gets(s[i]);
    }
    for(i=0;i<=n-1;i++)
    {
      l=strlen(s[i]);
      if(s[i][l-1]=='g'&&s[i][l-2]=='n'&&s[i][l-3]=='i') strncpy(w[i],s[i],l-3);
      else strncpy(w[i],s[i],l-2);
    }
     for(i=0;i<=n-1;i++)
    {
      puts(w[i]);
      
    }
    
}
void main()
{
   int n,i,j,a[100];
   char str[100][100];
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {
	   scanf("%s",str[i]);
	   a[i]=strlen(str[i]);
   }
   for(i=0;i<n;i++)
   {
	   if(str[i][a[i]-1]=='r'||str[i][a[i]-1]=='y')
	   {
		   for(j=0;j<a[i]-2;j++)
		   {
			   printf("%c",str[i][j]);
		   }
		   printf("\n");
	   }
	   if(str[i][a[i]-1]=='g')
	   {
           for(j=0;j<a[i]-3;j++)
		   {
			   printf("%c",str[i][j]);
		   }
		   printf("\n");
	   }
   }
}
void main()
{
int n,i,k,j;
scanf("%d",&n);
for(j=0;j<=n;j++)
{
char x[50];
gets(x);
k=strlen(x);
if(x[k-3]=='i'&&x[k-2]=='n'&&x[k-1]=='g'){for(i=0;i<k-3;i++)printf("%c",x[i]);}
else if(x[k-2]=='e'&&x[k-1]=='r'){for(i=0;i<k-2;i++)printf("%c",x[i]);}
else for(i=0;i<k-2;i++)printf("%c",x[i]);
printf("\n");
}
}
int main()
{
	int n, i, j;
	char s[100];
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{
		scanf("%s", s);
		if(s[strlen(s)-1]=='r' || s[strlen(s)-1]=='y')
		{
			for(j=0;j<strlen(s)-2;j++)
				printf("%c", s[j]);
			getchar();
			printf("\n");
		}
		else
		{
			for(j=0;j<strlen(s)-3;j++)
				printf("%c", s[j]);
			getchar();
			printf("\n");
		}
	}
	return 0;
}
int main()
{
    int m=0;
    int n;
    int j=0;
    char s[50][20];
    scanf("%d",&n);
    for(m=0;m<n;m++)
    {
       scanf("%s",s[m]);
     }
     for(m=0;m<n;m++)
     {
         j=strlen(s[m]);
         if((s[m][j-1]=='r')&&(s[m][j-2]=='e')){
            s[m][j-2]='\0';
		 }
         else if((s[m][j-1]=='y')&&(s[m][j-2]=='l')){
            s[m][j-2]='\0';
		 }
         else if((s[m][j-1]=='g')&&(s[m][j-2]=='n')&&(s[m][j-3]=='i')){
             s[m][j-3]='\0';
		 }
      }
       for(m=0;m<n;m++)
    {
       printf("%s\n",s[m]);
     }
     return 0;
}
int main(){
    int n,i;
    scanf("%d",&n);
    char a[33];
    for(i=0;i<n;i++){
        scanf("%s",a);
      int l=strlen(a);
     if(a[l-1]=='r'||a[l-1]=='y'){
         a[l-2]=0;
     }
     else if(a[l-1]=='g'){
         a[l-3]=0;
     }
          printf("\n%s",a);
      }
    return 0;
}
main(){
int n,i,j,k;
char words[33];
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<33;j++)
words[j]='\0';
scanf("%s",words);
k=strlen(words);
if(k>2){
if(words[k-1]=='g'){
if(words[k-2]=='n'){
if(words[k-3]=='i'){
for(j=1;j<4;j++)
words[k-j]='\0';
}
}
}
}
if(k>1){
if(words[k-1]=='r'){
if(words[k-2]=='e'){
for(j=1;j<3;j++)
words[k-j]='\0';
}
}
}
if(k>1){
if(words[k-1]=='y'){
if(words[k-2]=='l'){
for(j=1;j<3;j++)
words[k-j]='\0';
}
}
}
printf("%s\n",words);
}
}
int main()
{
	int n,i,j,l;
	char a[50][22];
    scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",a[i]);
	for(i=0;i<n;i++)
	{
		l=strlen(a[i]);
		if(a[i][l-1]=='r'&&a[i][l-2]=='e')
		{for(j=0;j<l-2;j++)
				printf("%c",a[i][j]);
		printf("\n");}
			else	if(a[i][l-1]=='y'&&a[i][l-2]=='l')
			{for(j=0;j<l-2;j++)
				printf("%c",a[i][j]);
			printf("\n");}
				else	if(a[i][l-1]=='g'&&a[i][l-2]=='n'&&a[i][l-3]=='i')
				{for(j=0;j<l-3;j++)
				printf("%c",a[i][j]);
				printf("\n");}
				else 
						{for(j=0;j<l;j++)
				printf("%c",a[i][j]);
				printf("\n");}
				}
	return(0);
}
int main(){
    char xi[50][35],y[50][35];
    int n,c,i,j;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",&xi[i]);
    }
        for(i=0;i<n;i++){
            c=strlen(xi[i]);
            for(j=0;xi[i][j]!='\0';j++){
                y[i][j]=xi[i][j];}
                if(xi[i][c-2]=='l'&&xi[i][c-1]=='y')
                    y[i][c-2]='\0';
                if(xi[i][c-2]=='e'&&xi[i][c-1]=='r')
                    y[i][c-2]='\0';
                if(xi[i][c-3]=='i'&&xi[i][c-2]=='n'&&xi[i][c-1]=='g')
                    y[i][c-3]='\0';
                printf("%s\n",y[i]);
        }
return 0;
}
int main()
{
int i,j,n,e;



char sz[50][33];
scanf("%d",&n);
for(i=0;i<n;i++)
    {
      scanf("%s",sz[i]);
    }
for(j=0;j<n;j++){
for(i=0;i<n;i++)
    {
      e=strlen(sz[i]);
             if(sz[i][e-1]=='y'||sz[i][e-1]=='r')
              {
             sz[i][e-2]='\0'; 
             break;
               }
         if(sz[i][e-1]=='g')
              {
             sz[i][e-3]='\0';
              break;
               }
  
    }
 printf("%s\n",sz[j]);    
}

return 0;
    
    
}
/* Note:Your choice is C IDE */
void main()
{
	int n,l[101];
	char s[101][101];
	int m,a,b,c,r;
	scanf("%d\n",&n);
	for(m=0;m<=n-1;m++)
	{
		gets(s[m]);
        l[m]=strlen(s[m]);
	}
	for(m=0;m<=n-1;m++)
	{
		a=l[m]-3;
		b=l[m]-2;
		c=l[m]-1;
		if(s[m][a]==105&&s[m][b]==110&&s[m][c]==103)
		{
			for(r=0;r<=l[m]-5;r++)
			printf("%c",s[m][r]);
			printf("%c\n",s[m][a-1]);
		}
		if(s[m][b]==101&&s[m][c]==114)
		{
			for(r=0;r<=l[m]-4;r++)
			printf("%c",s[m][r]);
			printf("%c\n",s[m][a]);
		}
		if(s[m][b]==108&&s[m][c]==121)
		{
			for(r=0;r<=l[m]-4;r++)
			printf("%c",s[m][r]);
			printf("%c\n",s[m][a]);
		}
	}    
}
void main()
{
	int n,i,len,j;
	char s[51][20];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		gets(s[i]);
	}
		for(i=0;i<n;i++)
	{
		len=strlen(s[i]);
		if(s[i][len-1]=='y' && s[i][len-2]=='l')
		{
			int j;
			for(j=0;j<len-2;j++)
				printf("%c",s[i][j]);
		}
		else if(s[i][len-1]=='g' && s[i][len-2]=='n' && s[i][len-3]=='i')
		{
			int j;
			for(j=0;j<len-3;j++)
				printf("%c",s[i][j]);
		}
		else if(s[i][len-1]=='r' && s[i][len-2]=='e')
		{
			int j;
			for(j=0;j<len-2;j++)
				printf("%c",s[i][j]);
		}
		printf("\n");
	}

}
void main()
{
	int n,i,j,l;
	char a[100][100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",a[i]);
		l=strlen(a[i]);
		if(a[i][l-2]=='e'&&a[i][l-1]=='r')
		{
			for(j=0;j<=l-3;j++)
				printf("%c",a[i][j]);
				printf("\n");
		}
		else if(a[i][l-3]=='i'&&a[i][l-2]=='n'&&a[i][l-1]=='g')
		{
			for(j=0;j<=l-4;j++)
				printf("%c",a[i][j]);
				printf("\n");
		}
		else if(a[i][l-2]=='l'&&a[i][l-1]=='y')
		{
			for(j=0;j<=l-3;j++)
	         	printf("%c",a[i][j]);
				printf("\n");
		}
		else printf("%s",a[i]);
	}
}
int main()
{
	int n,i,k;
	char w[10];
	scanf("%d", &n);
	for (i=0;i<n;i++)
	{
		scanf("%s", w);
		for (k=0;w[k]!='\0';k++)
		{
		}
		if (w[k-1]=='r'||w[k-1]=='y')
			w[k-2]='\0';
		else
			w[k-3]='\0';
		printf("%s\n", w);
	}
	return 0;
}
char st[50][33],src[33];
int n,i;
void del();
int main()
{
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
	 scanf("%s",&st[i]);
	 del();
	 printf("%s\n",src);
	 memset(src,0,20);
	}
	return 0;
}
void del()
{
	char str1[3]={'e','r'},str2[3]={'l','y'},str3[4]={'i','n','g'},str[4];
    int len;
	len=strlen(st[i]);
	strcpy(str,st[i]+len-2);
	if (strcmp(str1,str)==0)
		strncpy(src,st[i],len-2);
	else if (strcmp(str2,str)==0)
		strncpy(src,st[i],len-2);
	else {
		strcpy(str,st[i]+len-2);
		if (strcmp(str3,str)==0);
		strncpy(src,st[i],len-3);
	}
	return;
}
int main()
{
int n,i,l;
char s[100];
scanf("%d",&n);
for(i=1;i<=n;i++)
{
 scanf("%s",&s);
 l=strlen(s);
 if(s[l-1]=='g'){s[l]=0;s[l-1]=0;s[l-2]=0;s[l-3]=0;}
 else {s[l]=0;s[l-1]=0;s[l-2]=0;}
 l=strlen(s);
 printf("%s\n",s);
}
return 0;
}
int main()
{
	int n,i,a;
	char c[1];
	char ch[100];
	scanf("%d",&n);
	gets(c);
	for(i=1;i<=n;i++)
	{
		gets(ch);
		a=strlen(ch);
		if(ch[a-1]=='r'&&ch[a-2]=='e') 
		{ch[a-1]=0; ch[a-2]=0;}
		if(ch[a-1]==121&&ch[a-2]==108) 
		{ch[a-1]=0; ch[a-2]=0;}
		if(ch[a-1]=='g'&&ch[a-2]=='n'&&ch[a-3]=='i') 
		{ch[a-1]=0; ch[a-2]=0; ch[a-3]=0;}
		puts(ch);
	}
	return 0;
}
int main(){
   int n,p,q,t,m,i;
   char A[32],a[3]="er",b[3]="ly",c[4]="ing",e[3],d[4];
   scanf("%d",&n);
   for(i=0;i<n;i++){
       scanf("%s",A);
       m=strlen(A);
       e[0]=A[m-2];
       e[1]=A[m-1];
       e[2]='\0';
       d[0]=A[m-3];
       d[1]=A[m-2];
       d[2]=A[m-1];
       d[3]='\0';
        p=strcmp(e,a);
        q=strcmp(e,b);
        t=strcmp(d,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);
           }
       }
   }
       return 0;

}
int main(){
int n,i,j;
scanf("%d",&n);
char a[50][20];
for(i=0;i<n;i++){
    scanf("%s",a[i]);
}
for(i=0;i<n;i++){
    if(a[i][strlen(a[i])-1]=='r'||a[i][strlen(a[i])-1]=='y'){
		for(j=0;j<strlen(a[i])-2;j++){
		    printf("%c",a[i][j]);
		}
	}
	else{
        for(j=0;j<strlen(a[i])-3;j++){
		    printf("%c",a[i][j]);
		}
	}
	printf("\n");
}
return 0;
}
int main(int argc, char* argv)
{
    int n;
    char str[30];
    int len;
    scanf("%d",&n);
    while(n-->0)
    {
        scanf("%s",str);
        len = strlen(str);
        switch(str[len - 1])
        {
            case 'r'://er
            case 'y'://ly
                str[len-2] = 0;
                break;
            case 'g'://ing
                str[len-3]=0;
                break;
        }
        printf("%s\n",str);
    }
    return 0;
}
int main()
{
	char a[51][33];
	int n,b[51],i,j,m;
	scanf("%d\n",&n);
	for (i=0;i<n;i++) 
	{	gets(a[i]);
		b[i]=strlen(a[i]);
	
	}
	for (i=0;i<n;i++)
	{
		m=b[i];
		if (a[i][m-3]=='i'&&a[i][m-2]=='n'&&a[i][m-1]=='g')
	
			m=m-3;
			
		if (a[i][m-2]=='e'&&a[i][m-1]=='r')
		m=m-2;
		if (a[i][m-2]=='l'&&a[i][m-1]=='y')
		m=m-2;
		for(j=0;j<m-1;j++)
		{
				printf("%c",a[i][j]);
		}
			printf("%c\n",a[i][m-1]);
		
		
	}

	return 0;
}
void main()
{
	char s[50][30];
	int n,i;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
		gets(s[i]);
	for(i=0;i<n;i++)
	{
		if(s[i][strlen(s[i])-1]=='y'&&s[i][strlen(s[i])-2]=='l')
			s[i][strlen(s[i])-2]='\0';
		else if(s[i][strlen(s[i])-1]=='r'&&s[i][strlen(s[i])-2]=='e')
			s[i][strlen(s[i])-2]='\0';
		else if(s[i][strlen(s[i])-1]=='g'&&s[i][strlen(s[i])-2]=='n'&&s[i][strlen(s[i])-3]=='i')
			s[i][strlen(s[i])-3]='\0';
	}
	for(i=0;i<n;i++)
	{
		puts(s[i]);
	}
}
main()
{
	int n,i,j;
	char a[50][32];
	scanf("%d",&n);
	for(i=0;i<=n;i++)
		gets(a[i]);
	for(i=0;i<=n;i++)
	{
		for(j=0;a[i][j]!='\0';j++)
		{
			if(a[i][j]=='e'&&a[i][j+1]=='r'&&a[i][j+2]=='\0')
			{
				a[i][j]='\0';break;
			}
			if(a[i][j]=='i'&&a[i][j+1]=='n'&&a[i][j+2]=='g'&&a[i][j+3]=='\0')
			{
				a[i][j]='\0';break;
			}
			if(a[i][j]=='l'&&a[i][j+1]=='y'&&a[i][j+2]=='\0')
			{
				a[i][j]='\0';break;
			}
		}
	}
	for(i=0;i<=n;i++)
	{
		puts(a[i]);
	}

}
int main()
{
	char a[50][50];
	int n,i,len;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%s",a[i-1]);
	for(i=1;i<=n;i++)
	{
		len=strlen(a[i-1]);
		if((a[i-1][len-1]=='r')&&(a[i-1][len-2]=='e')) a[i-1][len-2]=0;
		else if((a[i-1][len-1]=='y')&&(a[i-1][len-2]=='l')) a[i-1][len-2]=0;
		else if((a[i-1][len-1]=='g')&&(a[i-1][len-2]=='n')&&(a[i-1][len-3]=='i')) a[i-1][len-3]=0;
	}
	for(i=1;i<=n;i++)
		printf("%s\n",a[i-1]);
    return 0;
}
void main()
{
int n,i,j,len;
char a[100];
scanf("%d",&n);
for(i=0;i<=n;i++)
{gets(a); 
len=strlen(a);
if (a[len-1]=='r'||a[len-1]=='y')
{
	for(j=0;j<=len-3;j++)
		printf("%c",a[j]);
}
else if(a[len-1]=='g')
{
	for(j=0;j<=len-4;j++)
		printf("%c",a[j]);
}
else for(j=0;j<=len-1;j++)
printf("%c",a[j]);
 printf("\n");
}
}
/*
 * homework3.cpp
 *
 *  Created on: 2012-12-4
 *      Author: Lixurong
 */

int main()
{
	int n;
	cin >> n;
	for( int i=0; i<n; i++ )
	{
		char a[40];
		cin >> a;
		if(a[strlen(a)-2]=='e' && a[strlen(a)-1]=='r')
		{
			a[strlen(a)-2]='\0';
		}
		else if(a[strlen(a)-2]=='l' && a[strlen(a)-1]=='y')
		{
			a[strlen(a)-2]='\0';
		}
		else
			a[strlen(a)-3]='\0';
		cout << a;
		if(i!=n-1) cout << endl;
	}
}
int main()
{
	int n,i,j;
	char word[50][30];
	int len[50];
	int a;
	scanf("%d",&n);
    for(i=0;i<n;i++) 
	{
		scanf("%s",word[i]);
		len[i]=strlen(word[i]);
	}

	for(i=0;i<n;i++)
	{
		if(word[i][len[i]-1]=='r'||word[i][len[i]-1]=='y') a=2;
		if(word[i][len[i]-1]=='g') a=3;
		for(j=0;j<len[i]-a-1;j++) printf("%c",word[i][j]);	
	    printf("%c\n",word[i][len[i]-a-1]);
	}

	return 0;
}
void main()
{
	int n,c,i;
	char a[50][50];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",a[i]);
		c=strlen(a[i]);
		if (a[i][c-1]=='r')
			a[i][c-2]='\0';
		else if(a[i][c-1]=='y')
			a[i][c-2]='\0';
		else a[i][c-3]='\0';
		printf("%s\n",a[i]);
	}


}
void main()
{
    int n,i,j,k;
    char c[50][50],b[50][50];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {scanf("%s",&c[i]);
    k=strlen(c[i]);	b[i][0]=c[i][k-2];	b[i][1]=c[i][k-1];
    if(strcmp(b[i],"er")==0) {for(j=0;j<k-2;j++) printf("%c",c[i][j]);}
    else if(strcmp(b[i],"ly")==0){for(j=0;j<k-2;j++) printf("%c",c[i][j]);}
    else  {for(j=0;j<k-3;j++) printf("%c",c[i][j]);}
    printf("\n");
    }
   }
int main()
{
	int n;
	scanf("%d",&n);
	char s[100];
	int i,len;
	for(i=0;i<n;i++)
	{
		scanf("%s",s);
		len=strlen(s);
		if(s[len-1]=='r'&&s[len-2]=='e')
		{
			s[len-1]=s[len];
			s[len-2]=s[len];
		}
		else if(s[len-1]=='y'&&s[len-2]=='l')
		{
		    s[len-1]=s[len];
			s[len-2]=s[len];
		}
		else
		{
			s[len-1]=s[len];
			s[len-2]=s[len];
			s[len-3]=s[len];
		}
		printf("%s\n",s);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int n,m,i,j,l;
	char a[50];
	
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%s",a);
		l=strlen(a);
		if (a[l-1]=='g') {for (j=0;j<=l-4;j++) printf("%c",a[j]);printf("\n");}
		else {for (j=0;j<=l-3;j++) printf("%c",a[j]);printf("\n");}
	}


	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	char string[100][20];
	int i,j;
	for(i=0;i<=n-1;i++)
		scanf("%s",&string[i]);
	int length;
	for(i=0;i<=n-1;i++)
	{
		length=strlen(string[i]);
		if(string[i][length-2]=='e' && string[i][length-1]=='r')
		{
			for(j=0;j<=length-3;j++)
				printf("%c",string[i][j]);
			printf("\n");
		}
		else if(string[i][length-2]=='l' && string[i][length-1]=='y')
		{
			for(j=0;j<=length-3;j++)
				printf("%c",string[i][j]);
			printf("\n");
		}
		else
		{
			for(j=0;j<=length-4;j++)
				printf("%c",string[i][j]);
			printf("\n");
		}
	}
	return 0;
}
int main()
{
        char str[50][30];
        int n,i,len;
        scanf("%d",&n);
        for(i=0;i<n;i++){
               scanf("%s",str[i]);
        }
        for(i=0;i<n;i++){
               len=strlen(str[i]);
               if(str[i][len-2]=='e') str[i][len-2]='\0';
               else if(str[i][len-2]=='l') str[i][len-2]='\0';
               else if(str[i][len-2]=='n') str[i][len-3]='\0';
               printf("%s\n",str[i]);
        }
        return 0;
}
int main()
{
    int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		char m[20],n[20];
		memset(n,0,sizeof(n));
		int k,j;
		scanf("%s",m);
		k = strlen(m);
		if(m[k-3]=='i')
		{
			for(j=0;j<k-3;j++)
			{

				n[j]=m[j];
			}
			printf("%s\n",n);
		}
		else
			{
			for(j=0;j<k-2;j++)
			{
				n[j]=m[j];
			}
			printf("%s\n",n);
		}
	}
	return 0;
}
int main()
{
int n,m,i,j,k,w;

char sfc[280];
scanf("%d",&n);
for (i=0;i<n;i++) {

scanf("%s",sfc);

if((sfc[strlen(sfc)-3])=='i')sfc[strlen(sfc)-3]=0;
else sfc[strlen(sfc)-2]=0;	
	


printf("%s\n",sfc);
}
return 0;
}
int main (){
	char num[100][288], s[260];
	int t, a, j, c=0;
    scanf("%d",&t);
	for(a=0;a<t;a++){
		scanf("%s",&num[a]);
	}

	for(a=0;a<t;a++){
		strcpy(s,num[a]);
        int k= strlen(s);
		if(s[k-1]=='r'&&s[k-2]=='e'){
			for(j=0;j<k-2;j++){
				printf("%c",s[j]);
			}
		}else if(s[k-1]=='y'&&s[k-2]=='l'){
			for(j=0;j<k-2;j++){
				printf("%c",s[j]);
			}
		}else if(s[k-1]=='g'&&s[k-2]=='n'&&s[k-3]=='i'){
			for(j=0;j<k-3;j++){
				printf("%c",s[j]);
			}
			}else{
				printf("%s",s);
			}
		printf("\n");

	}

	return 0;
}