semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
int n,l,i;
scanf("%d",&n);
char dc[50][50];

for(i=0;i<n;i++){
scanf("%s",dc[i]);
l=strlen(dc[i]);
if((dc[i][l-2]=='e')||(dc[i][l-2]=='l')){
dc[i][l-2]='\0';
printf("%s\n",dc[i]);
}
else if(dc[i][l-3]=='i'){
dc[i][l-3]='\0';
printf("%s\n",dc[i]);

}



}

return 0;
}
int main(){
int q,i,j;
char ZF[100][260];
scanf("%d",&q);
    for(i=0;i<q;i++){
			scanf("%s",ZF[i]);
	}
    for(i=0;i<q;i++){
	    for(j=0;ZF[i][j]!='\t';j++){
		    if((ZF[i][j-2]=='l')&&(ZF[i][j-1]=='y')&&(ZF[i][j]=='\0')){
				ZF[i][j-2]='\0';
			}else if((ZF[i][j-2]=='e')&&(ZF[i][j-1]=='r')&&(ZF[i][j]=='\0')){
				ZF[i][j-2]='\0';
			}else if((ZF[i][j-3]=='i')&&(ZF[i][j-2]=='n')&&(ZF[i][j-1]=='g')&&(ZF[i][j]=='\0')){
				ZF[i][j-3]='\0';
			}
		}
	}
	for(i=0;i<q;i++){
			printf("%s\n",ZF[i]);
	}	
	return 0;
}
void main()
{
	char str[50][20];
	int a,i,j,n;
	scanf("%d",&n);
	for (i=0;i<=n-1;i++)
		scanf("%s",str[i]);
	for (i=0;i<=n-1;i++)
	{
		a=strlen(str[i]);
		if (str[i][a-1]=='r')
			for (j=0;j<=a-3;j++)
				printf("%c",str[i][j]);
		else if (str[i][a-1]=='y')
			for (j=0;j<=a-3;j++)
				printf("%c",str[i][j]);
		else
			for (j=0;j<=a-4;j++)
				printf("%c",str[i][j]);
		printf ("\n");
	}
}
int main(){
    int n,i,a;
    scanf("%d",&n);
    int l[n];
    char dc[n][33];
    for(i=0;i<n;i++){
        scanf("%s",&dc[i]);
        l[i]=strlen(dc[i]);
    }
    for(i=0;i<n;i++){
        if(dc[i][l[i]-1]=='r'){dc[i][l[i]-1]=0;dc[i][l[i]-2]=0;}
        else if(dc[i][l[i]-1]=='y'){dc[i][l[i]-1]=0;dc[i][l[i]-2]=0;}
        else if(dc[i][l[i]-1]=='g'){dc[i][l[i]-1]=0;dc[i][l[i]-2]=0;dc[i][l[i]-3]=0;}
    }
    for(i=0;i<n;i++){
        printf("%s\n",dc[i]);
    }
    return 0;
}
void main()
{
    int m,n,i,j=0;
    char string[100];
    scanf("%d",&n);
    for(i=0;i<=n;i++)
    {
    	gets(string);
    	m=strlen(string);
    	for(j=0;j<m;)
    	j++;
    		if(string[m-1]=='r'||string[m-1]=='y')
    			m=m-2;	
    		if(string[m-1]=='g')
    		    m=m-3;
    		    for(j=0;j<m;j++)
    			printf("%c",string[j]);
    			printf("\n");
    }
}
int main()
{
	int n,i,j,a[100],b[100];
	char w[100][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",w[i]);
	for(i=0;i<n;i++)
	{
		a[i]=strlen(w[i]);
			if(w[i][a[i]-1]=='r')
			b[i]=a[i]-2;
			if(w[i][a[i]-1]=='y')
				b[i]=a[i]-2;
			if(w[i][a[i]-1]=='g')
				b[i]=a[i]-3;
			for(j=0;j<b[i];j++)
				printf("%c",w[i][j]);
		printf("\n");
	}
	return 0;
}
int main(){
	int n,i,l;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		char word[max+1];
		scanf("%s",word);
		l=strlen(word);
		if(strcmp(&word[l-1],"r")==0){
			word[l-2]=word[l-2]-'e'+'\0';
		}
		else if(strcmp(&word[l-1],"y")==0){
			word[l-2]=word[l-2]-'l'+'\0';
		}
		else if(strcmp(&word[l-1],"g")==0){
			word[l-3]=word[l-3]-'i'+'\0';
		}
		printf("%s\n",word);
	}
	return 0;
}
int main()
{
	int n,i;
	char s[33];
	scanf("%d\n",&n);
	for (i=1;i<=n;i++)
	{
		gets(s);
		int l=strlen(s)-1;
		if (s[l]=='g'&&s[l-1]=='n'&&s[l-2]=='i')
		{
			s[l-2]='\0';puts(s);
		}
		else
		{
			if ((s[l]=='y'&&s[l-1]=='l')||(s[l]=='r'&&s[l-1]=='e'))
			{
				s[l-1]='\0';puts(s);
			}
		}
	}
}
int main()
{
	char a[100];
int n,i;
char *p;
scanf("%d",&n);
getchar();
for(i=0;i<n;i++)
{   

	
	
	gets(a);
	p=a+strlen(a)-1;
	if(*p=='r'){for(p=a;p<a+strlen(a)-2;p++)printf("%c",*p);}
	else if(*p=='y'){for(p=a;p<a+strlen(a)-2;p++)printf("%c",*p);}
	else if(*p=='g'){for(p=a;p<a+strlen(a)-3;p++)printf("%c",*p);}
	printf("\n");
}
return 0;
}
void main()
{
  char str[50][15];
  int i,n,m;
  scanf("%d\n",&n);
  for(i=0;i<n;i++)
  gets(str[i]);
  for(i=0;i<n;i++)
  {
     
     m=strlen(str[i]);
     if(str[i][m-1]=='r')
      {
      str[i][m-2]='\0';
       }
     else if(str[i][m-1]=='y')
       {
       str[i][m-2]='\0';
       }
      else if(str[i][m-1]=='g')
       {
       str[i][m-3]='\0';
        }
      printf("%s\n",str[i]);
  }
}
int main(){
    char a[32], b[32];
    int n, i, j, len;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%s", &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-2;j++)b[j]=a[j];
            b[j]='\0';
            printf("%s\n", b);
        }
        if(a[len-1]=='g'&&a[len-2]=='n'&&a[len-3]=='i'){
            for(j=0;j<len-3;j++)b[j]=a[j];
            b[j]='\0';
            printf("%s\n", b);
        }
    }
    return 0;
}
void main()
{
	int n;
	int i,j,k;
	char str[50][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str[i]);
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<10;j++)
		{
			if(str[i][j]=='e'&&str[i][j+1]=='r'&&str[i][j+2]=='\0')
			{
				for(k=0;k<j-1;k++)
					printf("%c",str[i][k]);
				printf("%c\n",str[i][j-1]);
			}
			if(str[i][j]=='l'&&str[i][j+1]=='y'&&str[i][j+2]=='\0')
			{
				for(k=0;k<j-1;k++)
					printf("%c",str[i][k]);
				printf("%c\n",str[i][j-1]);
			}
			if(str[i][j]=='i'&&str[i][j+1]=='n'&&str[i][j+2]=='g'&&str[i][j+3]=='\0')
			{
					for(k=0;k<j-1;k++)
					printf("%c",str[i][k]);
				printf("%c\n",str[i][j-1]);
			}
		}
	}
}
int main()
{
	int n,i,j,len;
	char word[33];
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%s",word);
		len=strlen(word);
		if(word[len-1]=='r')
		{
			for(i=0;i<len-2;i++)
				printf("%c",word[i]);
		}
		else if(word[len-1]=='y')
		{
			for(i=0;i<len-2;i++)
				printf("%c",word[i]);
		}
		else 
		{
			for(i=0;i<len-3;i++)
				printf("%c",word[i]);
		}
		printf("\n");
	}
	return 0;
}
int main(){
    int n,i,j,m;
    int len[50];
    scanf("%d",&n);
    char a[50][32];
    char b[50][32];
    for(i=0;i<n;i++){
        scanf("%s",a[i]);
    }
    for(i=0;i<n;i++){
        len[i]=strlen(a[i]);
            
            if(a[i][len[i]-3]=='i'&&a[i][len[i]-2]=='n'&&a[i][len[i]-1]=='g'){
                for(m=0;m<len[i]-3;m++){
                    b[i][m]=a[i][m];
                }  b[i][len[i]-3]=='\0'; puts(b[i]);
            }
            else if((a[i][len[i]-2]=='e'&&a[i][len[i]-1]=='r')||(a[i][len[i]-2]=='l'&&a[i][len[i]-1]=='y')){
                for(m=0;m<len[i]-2;m++){
                    b[i][m]=a[i][m];
                }  b[i][len[i]-2]=='\0'; puts(b[i]);
            }
        
    }
    return 0;
}
int main(){
int n,i,j,g;
char m[50];
cin>>n;
for(i=0;i<n;i++){
                 cin>>m;
                 g=strlen(m);
                 if(m[g-1]=='r'||m[g-1]=='y'){
                 for(j=0;j<g-2;j++){
                 cout<<m[j];}
                 cout<<endl;}
                 else if(m[g-1]=='g'){
                      for(j=0;j<g-3;j++){
                      cout<<m[j];}
                      cout<<endl;}}

return 0;
}
int main()
{
	int n;int len;
	scanf("%d",&n);
	struct zfc
	{
		char zifu[20];
	};
	struct zfc line[50];
    int i;
	for(i=0;i<=n-1;i++) 
		scanf("%s",line[i].zifu);
	for(i=0;i<=n-1;i++)
	{
	    len=strlen(line[i].zifu);
	    if(line[i].zifu[len-1]=='r'&&line[i].zifu[len-2]=='e')
		{line[i].zifu[len-1]='\0';line[i].zifu[len-2]='\0';
		printf("%s\n",line[i].zifu);
		}

		else if(line[i].zifu[len-1]=='y'&&line[i].zifu[len-2]=='l')
		{
		line[i].zifu[len-1]='\0';line[i].zifu[len-2]='\0';
		printf("%s\n",line[i].zifu);
		}
		else if(line[i].zifu[len-1]=='g'&&line[i].zifu[len-2]=='n'&&line[i].zifu[len-3]=='i')
		{
			line[i].zifu[len-1]='\0';line[i].zifu[len-2]='\0';line[i].zifu[len-3]='\0';
			printf("%s\n",line[i].zifu);

		}
		else printf("%s",line[i].zifu);
	}
	return 0;
}
int main(){
	char sz[50][100];
	int n;
	scanf("%d",&n);
	int k;
	int sm[50];
	for(int i=0;i<n;i++){
		scanf("%s",sz[i]);
		sm[i]=strlen(sz[i]);
		k=sm[i];
		if(sz[i][k-1]=='r'&&sz[i][k-2]=='e'){
		sz[i][k-2]=0;
		printf("%s\n",sz[i]);
		}
		if(sz[i][k-1]=='y'&&sz[i][k-2]=='l'){
		sz[i][k-2]=0;
		printf("%s\n",sz[i]);}
		if(sz[i][k-1]=='g'&&sz[i][k-2]=='n'&&sz[i][k-3]=='i'){
		sz[i][k-3]=0;
		printf("%s\n",sz[i]);
		}
	}
	return 0;
}
int main(int argc, char* argv[])
{   int n,i,j,l;
    char w[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s",w);
	 l=strlen(w);
     if(w[l-1]=='y'&&w[l-2]=='l')
	    for(j=0;j<=l-3;j++)
	        printf("%c",w[j]);
     else if(w[l-1]=='r'&&w[l-2]=='e')
	    for(j=0;j<=l-3;j++)
	       printf("%c",w[j]);
	 else
         for(j=0;j<=l-4;j++)
	        printf("%c",w[j]);
	 printf("\n");
	}
	return 0;
}
int main(){
int LEN,n,i;
scanf("%d",&n);
char str[50][32];
for(i=0;i<=n;i++){
gets(str[i]);
    }
for(i=0;i<=n;i++){
        LEN=strlen(str[i]);
if(str[i][LEN-3]=='i'&&str[i][LEN-2]=='n'&&str[i][LEN-1]=='g'){
            str[i][LEN-3]='\0';
        }else if((str[i][LEN-2]=='e'&&str[i][LEN-1]=='r')||(str[i][LEN-2]=='l'&&str[i][LEN-1]=='y')){
            str[i][LEN-2]='\0';
        }
    }
for(i=0;i<=n;i++){
puts(str[i]);
    }
return 0;
}
int main()
{
int n;
scanf("%d",&n);
char str[100][100];
int i;
for(i=0;i<n;i++)
scanf("%s",str[i]);
for(i=0;i<n;i++)
{
if(str[i][strlen(str[i])-1]=='r'&&str[i][strlen(str[i])-2]=='e')
str[i][strlen(str[i])-2]='\0';
if(str[i][strlen(str[i])-1]=='y'&&str[i][strlen(str[i])-2]=='l')
str[i][strlen(str[i])-2]='\0';
if(str[i][strlen(str[i])-1]=='g'&&str[i][strlen(str[i])-2]=='n'&&str[i][strlen(str[i])-3]=='i')
str[i][strlen(str[i])-3]='\0';
}

for(int j=0;j<n;j++)
printf("%s\n",str[j]);

return 0;
}
int main(){
    int n,i,j,s,k;
    char c[40];
    scanf("%d",&n);
    for (i=0;i<n;i++){
        scanf("%s",c);
        s=strlen(c);
        if (c[s-2]=='e'&&c[s-1]=='r'){
           for (k=0;k<s-2;k++)  printf("%c",c[k]);
           printf("\n");
        }
        if (c[s-2]=='l'&&c[s-1]=='y'){
           for (k=0;k<s-2;k++)  printf("%c",c[k]);
           printf("\n");
        }
        if (c[s-3]=='i'&&c[s-2]=='n'&&c[s-1]=='g'){
           for (k=0;k<s-3;k++)  printf("%c",c[k]);
           printf("\n");
        }
    }
    return 0;
}
int main()
{
	int n,i,number;
	char str1[33];
	scanf("%d",&n);
	for(i=0,number=0;i<n;i++)
	{
		scanf("%s",str1);
		number=strlen(str1);
		if(str1[number-1]=='r')
		{
			str1[number-2]='\0';
			printf("%s\n",str1);
		}
		else
			if(str1[number-1]=='y')
			{
				str1[number-2]='\0';
				printf("%s\n",str1);
			}
			else
				if(str1[number-1]=='g')
				{
					str1[number-3]='\0';
					printf("%s\n",str1);
				}
	}
}
void main()
{
	char c[100][100];
	int j,i,n;
	int a[100];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{gets(c[i]);
	a[i]=strlen(c[i]);
	}
	for(i=0;i<n;i++)
		if(c[i][a[i]-1]=='r'||c[i][a[i]-1]=='y')
		{	for(j=0;j<a[i]-2;j++)
				printf("%c",c[i][j]);
		printf("\n");
		}
		else if(c[i][a[i]-1]=='g')
		{	for(j=0;j<a[i]-3;j++)
			printf("%c",c[i][j]);
		printf("\n");
		}

}
int main()
{
	int n,i,l;
	char t1[100],t2[100];
	char s[100][100],s1[4]="er",s2[4]="ly",s3[5]="ing";
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s[i]);
		l=strlen(s[i]);
		strcpy(t1,s[i]+l-2);
		strcpy(t2,s[i]+l-3);
		if(strcmp(t1,s1)==0){
			s[i][l-2]='\0';
		}
		if(strcmp(t1,s2)==0){
			s[i][l-2]='\0';
		}
		if(strcmp(t2,s3)==0){
			s[i][l-3]='\0';
		}
		puts(s[i]);
	}
	return 0;
}
int main()
{
	int n,i,l;
	char a[50][50],b[50][50];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",a[i]);
	}
	for(i=0;i<n;i++){
		l=0;
		l=strlen(a[i]);
		if(a[i][l-3]=='i'&&a[i][l-2]=='n'){
			strncpy(b[i],a[i],l-3);
		
		}
		else{strncpy(b[i],a[i],l-2);}
    	printf("%s\n",b[i]);
	}
         return 0; 
}
char s[100];
int l;
int n;
int main()
{
    int i;
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        l=strlen(gets(s));
            if(l>=3 && s[l-3]=='i' && s[l-2]=='n' && s[l-1]=='g')
            {
                s[l-3]='\0';
            }
            else if(l>=2 && s[l-2]=='e' && s[l-1]=='r')
            {
                s[l-2]='\0';
            }
            else if(l>=2 && s[l-2]=='l' && s[l-1]=='y')
            {
                s[l-2]=0;
            }
            puts(s);
        }
        return 0;
    }
int main(){
    
    char n[32];
    int a,b,c,d,i,j,k,l;
    scanf("%d",&k);
    for(l=1;l<=k;l++){
    scanf("%s",n);
    b=strlen(n);
    if(n[b-1]=='g')
        b=b-3;
    if(n[b-1]=='y')
        b=b-2;
    if(n[b-1]=='r')
        b=b-2;
    for(i=0;i<b;i++)
        printf("%c",n[i]);
        printf("\n");
    }
    return 0;
}
char key[3][4]={"er","ly","ing"};
char name[50];
char get[3];
char get3[3];
int main(){
	int n;
	cin>>n;
	int len;
	for(int i=0;i<n;i++){
		cin>>name;
		len = strlen(name);
		for(int j=len-3;j<len;j++){
			get3[j-len+3] = name[j];
			}
		for(int j = len - 2;j<len;j++){
			get[j-len+2] = name[j];
			}
		if(strcmp(get,key[0])==0||strcmp(get,key[1])==0){
			for(int j = 0;j<len-2;j++){
				cout<<name[j];
				}
			cout<<endl;
			continue;
			}
		if(strcmp(get3,key[2])==0){
			for(int j = 0;j<len-3;j++){
				cout<<name[j];
				}
			cout<<endl;
			continue;
			}
		}
	return 0;
	}
int main()
{
    int n,l,i;
    char s[1000];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
      scanf("%s",s);
      l=strlen(s);
      s[l]='\0';
      if(s[l-1]=='r'&&s[l-2]=='e')
      s[l-2]='\0';
      else if(s[l-1]=='y'&&s[l-2]=='l')s[l-2]='\0';
      else s[l-3]='\0';
      printf("%s\n",s);
      }
      getchar();
      getchar();
}
int main()
{
    int n,i,b;
    char a[50],*p,d;
    scanf("%d",&n);
    for(i=0;i<n;i++)
{
    scanf("%s",&a);
       b=strlen(a) ;
       p=&a[b-2];
       if((*p=='l')||(*p=='e'))
       {
            *p='\0';
            printf("%s\n",a);
       }
       else
       {
          p=&a[b-3];
          *p='\0';
        printf("%s\n",a);
       }
    }
     scanf("%s",&d);
     return 0;
}
void main()
{
	char a[50][50];
	int i,j,n;
	scanf("%d",&n);
	for(i=0;i<n+1;i++)
	gets(a[i]);
	for(i=0;i<n+1;i++)
	{
	    if(a[i][strlen(a[i])-2]=='l'&&a[i][strlen(a[i])-1]=='y')
		{a[i][strlen(a[i])-1]=0; a[i][strlen(a[i])-1]=0;}
		else if(a[i][strlen(a[i])-2]=='e'&&a[i][strlen(a[i])-1]=='r')
		{a[i][strlen(a[i])-1]=0; a[i][strlen(a[i])-1]=0;}
		else if(a[i][strlen(a[i])-2]=='n'&&a[i][strlen(a[i])-1]=='g'&&a[i][strlen(a[i])-3]=='i')
		{a[i][strlen(a[i])-1]=0; a[i][strlen(a[i])-1]=0;a[i][strlen(a[i])-1]=0;}
    }
	
		for(i=0;i<n+1;i++)
	printf("%s\n",a[i]);

}
main()
{
      int n;
      scanf ("%d",&n);
      int i,j;
      char a[55][32];
      for (i=0;i<n;i++)
      {
          scanf ("%s",a[i]);
      }
      for (i=0;i<n;i++)
      {
          int len=strlen(a[i]);
          int lenf=0;
          if (a[i][len-3]=='i'&&a[i][len-2]=='n'&&a[i][len-1]=='g') lenf=len-3;
          else if ((a[i][len-2]=='e'&&a[i][len-1]=='r')||(a[i][len-2]=='l'&&a[i][len-1]=='y')) lenf=len-2;
          for (j=0;j<lenf;j++)
          {
              printf ("%c",a[i][j]);
          }
          printf ("\n");
      }
}
int main()
{
  int n,i,j,k;
  scanf("%d",&n);
  char da[n][32];
  for(i=0;i<n;i++)
  {
	  scanf("%s",da[i]);
  }
  for(i=0;i<n;i++)
  {
      k=strlen(da[i]);
	  if(da[i][k-1]=='r'&&da[i][k-2]=='e')
	  { da[i][k-1]='\0';
	  da[i][k-2]='\0';}
      if(da[i][k-1]=='y'&&da[i][k-2]=='l')
      {  da[i][k-1]='\0';
	  da[i][k-2]='\0';}
      if(da[i][k-1]=='g'&&da[i][k-2]=='n'&&da[i][k-3]=='i')
	  { da[i][k-1]='\0';
		da[i][k-2]='\0';
		da[i][k-3]='\0';}
	  puts(da[i]);



  }

  return 0;




}
int main()
{
	int n;
	scanf("%d",&n);
	char a[50][20];
	char b[50][20];
	int t[50];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s",&a[i]);
		t[i]=strlen(a[i]);
		if(a[i][t[i]-1]=='r')
		{
			int j;
			for(j=0;j<t[i]-2;j++)
				b[i][j]=a[i][j];
		
		}
		else if(a[i][t[i]-1]=='g')
		{
			int j;
			for(j=0;j<t[i]-3;j++)
				b[i][j]=a[i][j];
		
		}
		else if(a[i][t[i]-1]=='y')
		{
			int j;
			for(j=0;j<t[i]-2;j++)
				b[i][j]=a[i][j];
		
		}
	}
	for(i=0;i<n;i++)
	{
		int j;
		if(a[i][t[i]-1]=='r'||a[i][t[i]-1]=='y')
			for(j=0;j<t[i]-2;j++)
				printf("%c",b[i][j]);
		else if(a[i][t[i]-1]=='g')
			for(j=0;j<t[i]-3;j++)
				printf("%c",b[i][j]);
		printf("\n");
	}
	return 0;	
}
int main(){
	int n,i,j,len;
	char word[51][33];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",word[i]);
		
	}
	for(i=0;i<n;i++){
		len=strlen(word[i]);
		for(j=len;j>0;j--){
			
			if((word[i][j]=='r')&&(word[i][j-1]=='e')){
				word[i][j-1]='\0';
				break;
			}else if((word[i][j]=='y')&&(word[i][j-1]=='l')){
				word[i][j-1]='\0';
				break;
			}else if((word[i][j]=='g')&&(word[i][j-1]=='n')&&(word[i][j-2]=='i')){
				word[i][j-2]='\0';
				break;
			}
		}
		printf("%s\n",word[i]);
	}
	return 0;
	
}
int main()
{
	void cut1(char a[],int b);
	void cut2(char a[],int b);
	char word[32];
	int n,i,a,j;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{   
		for(j=0;j<=31;j++)
		word[j]='\0';
		scanf("%s",word);
		a=strlen(word);
		if(word[a-3]=='i')
			cut1(word,a);
		if(word[a-2]=='l'||word[a-2]=='e')
			cut2(word,a);
		printf("%s\n",word);
	}
	return 0;
}
void cut1(char a[],int b)
{
	a[b-3]='\0';
}
void cut2(char a[],int b)
{
    a[b-2]='\0';
}
int main(){
    int i,j,n,len;
    char zfc[33];
    scanf("%d",&n);
    for(i=0;i<=n;i++){
        gets(zfc);
        len=strlen(zfc);
        if(zfc[len-1]=='r'){
            if(zfc[len-2]=='e'){
                
                zfc[len-2]='\0';
            }
        }else if(zfc[len-1]=='g'){
            if(zfc[len-2]=='n'){
                if(zfc[len-3]=='i'){
                     zfc[len-3]='\0';
                    
                }
            }
        }else if(zfc[len-1]=='y'){
            if(zfc[len-2]=='l'){
              
                zfc[len-2]='\0';
        }
    }
    printf("%s\n",zfc);
    }
   
    return 0;
}
void main()
{
	int n, i, l[50];
	char a[50][50];
	scanf("%d\n", &n);
	for(i=0; i<n; i++)
	{
		gets(a[i]);
		l[i]=strlen(a[i]);
	}
	for(i=0; i<n; i++)
	{
		if(a[i][l[i]-2]=='e'&&a[i][l[i]-1]=='r')
		{
			a[i][l[i]-2]='\0';
			puts(a[i]);
		}
		else if(a[i][l[i]-2]=='l'&&a[i][l[i]-1]=='y')
		{
			a[i][l[i]-2]='\0';
			puts(a[i]);
		}
		else if(a[i][l[i]-3]=='i'&&a[i][l[i]-2]=='n'&&a[i][l[i]-1]=='g')
		{
			a[i][l[i]-3]='\0';
			puts(a[i]);
		}
	}
}
int main(){
    int n,i,k,h[50];
    char s[50][255],sz[50][255];
    scanf("%d",&n);
    for(i=0; i<n; i++){    
         scanf("%s", s[i]);
         h[i]=strlen(s[i]);
                     }
    for(i=0;i<n;i++){
    if(s[i][h[i]-1]=='r'){for(k=0;k<h[i]-2;k++){sz[i][k]=s[i][k];}}
    if(s[i][h[i]-1]=='y'){for(k=0;k<h[i]-2;k++){sz[i][k]=s[i][k];}}
    if(s[i][h[i]-1]=='g'){for(k=0;k<h[i]-3;k++){sz[i][k]=s[i][k];}}
}
     for(i=0;i<n;i++){
                      puts(sz[i]);}
                      return 0;
                      }
int main()
{
	char word[32],n,i,j,k,len,temp[32];
	scanf("%d\n",&n);
	for (i=1;i<=n;i++)
	{
		gets(word);
		len=strlen(word);
		for (j=len-2;j<=len;j++) temp[j-len+2]=word[j];
		if (strcmp(temp,"er")==0 || strcmp(temp,"ly")==0) 
		{
			word[len-2]='\0';
			printf("%s\n",word);
		}
		for (j=len-3;j<=len;j++) temp[j-len+3]=word[j];
		if (strcmp(temp,"ing")==0) 
		{
			word[len-3]='\0';
			printf("%s\n",word);
		}
	}
	return 0;
}
int main()
{
	int n,i;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		int p,h;
		char a[20];
	    for(p=0;;p++)
		{
			scanf("%c",&a[p]);
			if(a[p]=='\n')
				break;
		}
		if(a[p-1]=='r')
		{
			if(a[p-2]=='e')
			{
				for(h=0;h<p-2;h++)
				{
					printf("%c",a[h]);
				}
	            printf("\n");
			}
			else
			{
				for(h=0;h<p;h++)
				{
					printf("%c",a[h]);
				}
				printf("\n");
			}
		}
		else if(a[p-1]=='y')
		{
			if(a[p-2]=='l')
			{
				for(h=0;h<p-2;h++)
				{
					printf("%c",a[h]);
				}
				printf("\n");
			}
			else
			{
				for(h=0;h<p;h++)
				{
					printf("%c",a[h]);
				}
				printf("\n");
			}
		}
        else if(a[p-1]=='g')
		{
			if(a[p-2]=='n')
			{
				if(a[p-3]=='i')
				{
				     for(h=0;h<p-3;h++)
					 {
				    	printf("%c",a[h]);
					 }
					 printf("\n");
				}
			    else
				{
				  for(h=0;h<p;h++)
				  {
				    	printf("%c",a[h]);
				  }	
				  printf("\n");
				}
			}
			else 	
			{
				for(h=0;h<p;h++)
				{
					printf("%c",a[h]);
				}
				printf("\n");
			}
		}
		else 
		{
			for(h=0;h<p;h++)
			{
				printf("%c",a[h]);
			}
			printf("\n");
		}
	}
	return 0;
}
int main(){
	int n,suffixlen;
	char word[40],*p;
	scanf("%d", &n);
	for(int i =0; i<n; i++){
		scanf("%s", word);
		for(p = word;*p;p++);
		switch(*(p-1))
		{
			case'r':suffixlen = 2;break;
			case'y':suffixlen = 2;break;
			case'g':suffixlen = 3;break;
		}
		*(p-suffixlen) ='\0';
		printf("%s\n",word);
	}
		return 0;
}
int main()
{
	char str[50][100];
	int length[50];
	int i,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",str[i]);
	}
	for(i=0;i<n;i++){
		length[i] =strlen(str[i]);
		if (str[i][length[i]-1]=='r'||str[i][length[i]-1]=='y'){
			for(j=length[i]-2;j<100;j++){
				str[i][j] = '\0';
			}
			printf("%s\n",str[i]);
		}
		else if (str[i][length[i]-1]=='g'){
			for(j=length[i]-3;j<100;j++){
				str[i][j] = '\0';
				
			}
			printf("%s\n",str[i]);
		}
	}
	return 0 ;
}
int main(){
	int n,i,k;
	char a[51][33],b[51];
	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++){
		if (a[i][b[i]-1]=='r')
			a[i][b[i]-2]='\0';
		else if (a[i][b[i]-1]=='y')
			a[i][b[i]-2]='\0';
		else if (a[i][b[i]-1]=='g')
			a[i][b[i]-3]='\0';
	}
	for(i=0;i<n;i++){
		printf("%s\n",a[i]);
	}
	return 0;
}
void main()
{
	char c[200][200];
	int i,j,k,m,n,a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",c[i]);
		a[i]=strlen(c[i]);
	}
	for(i=0;i<n;i++)
	{
		if(c[i][a[i]-1]=='r'||c[i][a[i]-1]=='y')
			for(j=0;j<a[i]-2;j++)
				printf("%c",c[i][j]);
		else
				for(j=0;j<a[i]-3;j++)
				printf("%c",c[i][j]);
				printf("\n");
	}
}
int main()
{
    int len,n,i,j; 
	scanf("%d",&n);
    char s[33];               
    for (i = 0; i < n; i++) {
		scanf("%s",&s);
		len=strlen(s);
		for(j=0;j<len;j++){
			if(s[j]=='e'&&s[j+1]=='r'&&s[j+2]=='\0'){
			s[j]='\0';
			}
			else if(s[j]=='l'&&s[j+1]=='y'&&s[j+2]=='\0'){
			s[j]='\0';
			}
			else if(s[j]=='i'&&s[j+1]=='n'&&s[j+2]=='g'&&s[j+3]=='\0'){
			s[j]='\0';
			}
		}
		printf("%s\n",s);
    }

	

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

	char danCi[N][LEN];

	int n, i, len;

	scanf("%d", &n);

	for(i = 0; i < n; i++){
		scanf("%s", danCi[i]);
	}

	for(i = 0; i < n; i++){
		len = strlen(danCi[i]);

		if((danCi[i][len - 1] == 'r') || (danCi[i][len - 1] == 'y')){
			danCi[i][len - 2] = 0;
		}else{
			danCi[i][len - 3] = 0;
		}

	}

	for(i = 0; i < n; i++){
		printf("%s\n", danCi[i]);
	}
	
	return 0;
}
int main()
{
	int n, i, j, lenth[50];
	char word[50][35];
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{scanf("%s",word[i]);}
	
	for(i=0;i<n;i++)
	{lenth[i]=strlen(word[i]);
		
	if(word[i][lenth[i]-1]=='g')
	{
	for(j=0;j<lenth[i]-3;j++)
	{printf("%c",word[i][j]);}
	printf("\n");
	}
	
	else if(word[i][lenth[i]-1]=='y')
		{
		for(j=0;j<lenth[i]-2;j++)
		{printf("%c",word[i][j]);}
		printf("\n");
		}
	else if("%c",word[i][lenth[i]-1]=='r')
		{
		for(j=0;j<lenth[i]-2;j++)
		{printf("%c",word[i][j]);}
		printf("\n");
		}
	}
	
		return 0;
	}
int main()
{  
    int n,l,i;
    char a[33];
    cin>>n;
    while(n--)
    {
        cin>>a;
        l=strlen(a);
        if((a[l-1]=='r')||(a[l-1]=='y'))
        {
            for(i=0;i<l-2;i++)
                cout<<a[i];
        }
        if(a[l-1]=='g')
        {
           for(i=0;i<l-3;i++)
               cout<<a[i];
        }
        cout<<endl;
    }
    return 0;
}
int main(int argc, char* argv[])
{
	int n,i;
	char c[50][20],t[50];
	scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%s",c[i]);
    for (i=0;i<n;i++)
	{
		t[i]=strlen(c[i])-1;
		if (c[i][t[i]]=='r')
		{
			c[i][t[i]]='\0';
			c[i][t[i]-1]='\0';
		}

        if (c[i][t[i]]=='y')
		{
			c[i][t[i]]='\0';
			c[i][t[i]-1]='\0';
		}
        if (c[i][t[i]]=='g')
		{
			c[i][t[i]]='\0';
			c[i][t[i]-1]='\0';
			c[i][t[i]-2]='\0';
		}
	}
	
	for (i=0;i<n;i++)
		printf("%s\n",c[i]);
	return 0;
}