semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void pd(char *p,int m)
{
	char *head,*end,*t,*q;
	head=p;
	int zhi=0,j;
	end=p+m-1;
   for(t=head,q=end;t<=end;t++,q--)
	{if(*t==*q)zhi=1;
     else{zhi=0;break;}}
	if(zhi==1)
	{for(t=head;t<=end;t++)
		printf("%c",*t);
	printf("\n");}
}
void main()
{
	char a[1000]={0};
    char *p;
	int n,i;
	gets(a);
	for(p=a,n=0;*p!='\0';p++,n++);
   for(i=2;i<=n;i++)
			for(p=a;p<a+n-i+1;p++)
			pd(p,i);
}
char str[500];
int length;
int check(int start,int len);
int ctr1,ctr2,ctr3;
int main(void)
{
	gets(str);
	length=strlen(str);
	for(ctr1=2;ctr1<=length;ctr1+=2)
	{
		for(ctr2=0;ctr2<=length-ctr1;ctr2++)
		{
			check(ctr2,ctr1);
		}
	}
	return 0;
}
int check(int start,int len)
{
	char a[500];
	char b[500];
	int i;
    for(i=0;i<500;i++)
	{
		a[i]='\0';
		b[i]='\0';
	}
	for(i=0;i<len;i++)
	{
		a[i]=str[i+start];
		b[i]=str[len-i+start-1];
	}
	if(strcmp(a,b)==0)
	{
		puts(a);
		return 1;
	}
	else
		return 0;
}
int main()
{
	int i,j,len,n;
	char a[500],b[500];
	gets(a);
	len=strlen(a);
	for(j=0;j<len;j++)
	{
		for(i=0;i<len;i++)
		{
			if(i>=j)
				if((a[i-j]==a[i+j+1])&&(a[i-j+1]==a[i+j]))

			{				
				n=0;
				for(;n<=2*j+1;n++)
				{
					printf("%c",a[i-j+n]);}
				printf("\n");
			}
			else
				continue;
		}
	}
	return 0;
}
/*
 * file    homework 9_5
 * author  ??
 * date    2010-11-24
 * description
           ???????????????????
*/



int isHuiwen(char hw[])
{
	int len, i;
	len = strlen(hw);
	for (i = 0; i <= (len - 1) / 2; i ++)
		if (hw[i] != hw[len - 1 - i])
			break;
	if (i > (len - 1) / 2)
		return 1;
	else 
		return 0;
}

int main()
{
	char str[501], hw[501];
	int i, j, len;
	cin >> str;
	len = strlen(str);
	for (i = 2; i <= len; i ++)                           // i????????
		for (j = 0; j <= len - i; j ++)
		{
			strncpy(hw, str + j, i);
			hw[i] = '\0';
			if (isHuiwen(hw))
				cout << hw << endl;
		}

	return 0;
}
void check(char a[], int i, int j)
{
    int k, m = 0;
    for (k = 0; k <= i / 2; k++)
    {
        if (a[j + k] != a[j + i - 1 - k])
        {
            m = 1;
            break;
        }
    }
    if (m != 1)
    {
        for (k = 0; k < i; k++)
        {
            cout << a[j + k];
        }
        cout << endl;
    }
}

int main()
{
    char a[500];
    int n, i, j;
    cin.getline(a, 500);
    i = 0;
    while (a[i] != '\0')
    {
        i++;
    }
    n = i;
    for (i = 2; i <= n; i++)
    {
        for (j = 0; j <= n - i; j++)
        {
            check(a, i, j);
        }
    }
    return 0;
}
//*************************
//*??????  1200062705
//*????4.????
//*???2012-11-18
//*************************
int main()
{
	int i, j, p, n;
	char string[501]; // ??????
	cin >> string;
	n = strlen(string); // ?????
	for (i = 2; i <= n; i++) //
    {
		for (j = 0; j < n; j++)
	    {
			for (p = 0; p < i / 2; p++)
		    {
				if (string[j + p] != string[j + i - p - 1])		break;
		    }
				if (p == i / 2)
		        {
					for (p = j; p < j + i; p++)
					{
						cout << string[p];
					}
					cout << endl;
				 }
	    }
    }
return 0;
}
/*
???:Huiwen()
??:???????????,?????1,????0
**/
int Huiwen(char part[])
{
	char check[501];
	memset(check, 0, sizeof(check));
	int i, j, len;
	len = strlen(part);
	j = len - 1;
	for (i = 0; i < len; i++)
		check[j--] = part[i];
	check[len] = '\0';
	return (!(strcmp(part, check)));
}

int main()
{
	char input[501];
	char part[501];
	cin.getline(input, 500);
	int i, j, k, t, len, n;
	len = strlen(input);
	for (n = 2; n <= len; n++)
	{
		for (i = 0; i <= len - n; i++)
		{
			memset(part, 0, 501);
			part[0] = input[i];
			k = 1;
			for (j = i + 1; j < i + n; j++)
				part[k++] = input[j];
			part[k] = '\0';
			if (Huiwen(part))
			{
				for (t = 0; t < k; t++)
					cout << part[t];
				cout << endl;
			}
		}
	}
	return 0;
}
int main()
{
	char m[500];
	cin.getline(m,500);
	int len,f;
	len=strlen(m);
	for(int i=2;i<=len;i++)//??
		for(int j=0;j<=len-i;j++)//?????
			for(int q=j;q<i+j;q++)//q??????
			{
				f=i+j*2;//???????? ?????????? ???????i j ???? 
				if(m[q]!=m[f-q-1])break;
				if((q+1)>=(f-q-2))
				{
					for(int k=j;k<i+j;k++)
					{
						if(k==i+j-1)
							cout<<m[k]<<endl;
						else
							cout<<m[k];
					}
					break;
				}
			}
			return 0;
}
int main()
{
  char a[500];
  int i,j,h,l,b[500],k;
  gets(a);
  l=strlen(a)-1;
  for(i=0;i<=l-1;i++)
       b[i]=0;
  for(i=0;i<=l-1;i++)
    {
       k=0;
       while(a[i-k]==a[i+1+k])
          {
              k++;
              if((i-k<0)||(i+k>l)) break;
           }
       b[i]=k;
     }
  for(j=1;j<=l/2+1;j++)
    for(i=1;i<=l-2;i++)
      if(b[i]>=j)
        {
           for(h=i-j+1;h<=i+j;h++)
            printf("%c",a[h]);
           printf("\n");
        } 
}
void main()
{
	int i,j,p,m,b,c;
	char a[500];
	scanf("%s",&a);
	c=strlen(a);
	for(i=0;i<c;i++)
	{
		if(a[i]==a[i+1])
			printf("%c%c\n",a[i],a[i]);
	}
	for(p=3;p<c;)
	{
		for(i=0;i<c-p;i++)
		{
			b=0;
			for(m=0;m<p/2+1;m++)
			{
				if(a[i+m]==a[p-m+i])
				{b++;}
			}
			if(b==(p/2)+1)
			{
				for(j=i;j<=i+p;j++)
				{
					printf("%c",a[j]);
				}
				printf("\n");
			}
		}
		p+=2;
	}
}
int main()
{
   char a[500];
   cin.getline(a,500,'\n');
   int b=strlen(a);
   int wide=2;
   while(1)
   {
   for(int i=0;i<b-1;i++)
     {
       if(a[i]==a[i+1])
         {
           if(i+1-i+1==wide)
            cout<<a[i]<<a[i+1]<<endl;
            int m=i,n=i+1;
            while(1)
            {
               m--;
               n++;
               if(a[m]==a[n])
                {
                  if(n-m+1==wide)
                  for(int k=m;k<=n;k++)
                    cout<<a[k];
                  cout<<endl;
                }
               else
                break;
             }
          }
      }
    wide+=2;
    if(wide==b+2)
    break;
  }

 return 0;
 }
void main()
{
	char s[500],*p1,*p2,*p;
	int i,j,n;
	gets (s);
	n=strlen(s);
	for (i=1;i<n;i++)
	{
		for (p1=s;*(p1+i)!='\0';p1++)
		{
			p2=p1+i;
			for (j=0;j<i;j++)
			{
				if (*(p1+j)!=*(p2-j)) break;
			}
			if (j==i)
			{
				for (p=p1;p<=p2;p++)
					printf("%c",*p);
				printf("\n");
			}
		}
	}
}
int main(){
	char a[501];
	int k;
	cin.getline(a,501);
	for(int i=1;i<=strlen(a);i++)
		for(int j=0;j<=(strlen(a)-i);j++){
			for(k=0;k<=i/2;k++){
				if(a[j+k]!=a[j+i-k])break;
			}
			if(k==(i/2+1)){
				for(int l=j;l<=j+i;l++)
					cout<<a[l];
				cout<<endl;
			}
		}
	return 0;
}
int main()
{
	char s[500];
	int i,j,p,q,l,t=1;
	gets(s);
	l=strlen(s);
	i=0;j=1;p=0;q=0;
	for(j=1;j<l;j++){
	
		for(i=0;i<=l-j;i++){
			for(p=i,q=i+j;p<=q;p++,q--){
				if(s[p]==s[q])t=t*1;
				else t=t*0;}
			if(t==1){
				for(t=i;t<i+j;t++){printf("%c",s[t]);}printf("%c\n",s[i+j]);}t=1;}}}
void strre(char a[])
{
	int i,j,k;
	char t;
	k=strlen(a);
	for(j=0,i=k-1;j<k/2;j++,i--)
	{
		t=a[j];
		a[j]=a[i];
		a[i]=t;
	}
}
void main()
{
	int i,j,k=0,t;
	char a[600],b[500][500],c[500],d[500];
	gets(a);
	t=strlen(a);
	for(i=0;i<t-2;i++)
		for(j=i+1;j<t;j++)
		{
			strncpy(c,a+i,j-i+1);
			c[j-i+1]='\0';
			strcpy(d,c);
			strre(d);
			if(!strcmp(c,d))
			{
				strcpy(b[k],c);
				k++;
			}
			strcpy(b[k],"\0");
		}
	for(i=0;i<k-1;i++)
		for(j=0;j<k-i-1;j++)
		{
			if(strlen(b[j])>strlen(b[j+1]))
			{
				strcpy(c,b[j]);
				strcpy(b[j],b[j+1]);
				strcpy(b[j+1],c);
			}
		}
	for(i=0;i<k;i++)
		printf("%s\n",b[i]);
}
int main()
{
	int i,j,k,n;
	char a[501];
	cin.getline(a,501);
	n=strlen(a);
	for(i=2;i<=n;i++)
	{
		for(j=0;j<=n-i;j++)
		{
			for(k=0;k<=i/2;k++)
			{
				if(a[j+k]!=a[j+i-1-k])
					break;
			}
			if(k==i/2+1)
			{
				for(k=j;k<=j+i-1;k++)
					cout<<a[k];
				cout<<endl;
			}
		}
	}
	return 0;
}
void main()
{
	char c[500];
	scanf("%s",&c);
	int i,j,k,l;
	for(i=2;i<=strlen(c);i++)
	{
		for(j=0;j+i-1<strlen(c);j++)
		{
			char s1[500]={'\0'},s2[500]={'\0'};
			for(k=j;k<=j+i-1;k++)
			{
				s1[k-j]=c[k];
			}
			for(l=0;l<i;l++)
			{
				s2[l]=s1[i-l-1];
			}
			if(strcmp(s1,s2)==0)
				printf("%s\n",s1);
		}
	}
}
/*
 * 1.cpp
 *
 *  Created on: 2011-12-19
 *      Author: 1100012870
 */
char s[501];

void print(int x,int y)         //??????s???x??y?????
{
	int i;
	for(i=x;i<=y;i++)cout<<s[i];
	cout<<endl;
}

int check(int x,int y)          //?????????????
{
	while(x<y && s[x]==s[y]){   //????????????
		x++;
		y--;
	}
	if(x>=y) return 1;
	return 0;
}

int main()
{
	int i,j,l;
	cin.getline(s,501);
	l=strlen(s);
	for(i=1;i<=l;i++)          //????2???????
		for(j=0;j<l;j++)
			if(j+i<l && check(j,j+i)==1)
				print(j,j+i);
	return 0;
}
int f(char(num[]));
int main()
{
	int len , i , j , k; 
	char str[500] , real[500];
	cin >> str ;
	len = strlen(str) ;
	for(i = 2 ; i <= len ; i++)
		for (j = 0 ; j < len - i + 1 ; j++)
			{
				for (k = 0 ; k < i ; k++)
					real[k] = str[j + k] ;
				real[i] = '\0' ;
				if (f(real))	cout << real << endl ;
			}
	return 0 ;
}
int f(char(num[]))
{
	int len , i;
	char another[500];
	len = strlen(num);
	for(i = 0 ; i < len ; i++)
		another[i] = num[len -1 -i] ;
	another[len] = '\0' ;
	if (strcmp(another,num) == 0)	return 1 ;
	else return 0 ;
}
void main()
{
	char a[505];
	int i,j,k,count;
	gets(a);
	
	for(i=2;i<=strlen(a);i++)
		for(j=0;(j+i)<=strlen(a);j++)
		{
			count=0;
			for(k=0;k<(i/2);k++)
				if(a[j+k]==a[j+i-1-k]) count++;
			if(count==i/2) 
			{
				for(k=j;k<j+i;k++)
					printf("%c",a[k]);
				printf("\n");
			}
		}
}
int main()
{
    char a[500];
    char b[500];
    int len,i,j,k,judge;
    fgets(a,500,stdin);
    len=strlen(a)-1;
    for(i=0;i<len;i++)
        b[len-1-i]=a[i];
    for(i=2;i<=len;i++)
        for(j=0;j<=len-i;j++)
        {
            judge=0;
            for(k=0;k<=i-1;k++)
            {
                judge=judge+(a[j+k]-b[len-i-j+k])*(a[j+k]-b[len-i-j+k]);
            }
            if(judge==0)
            {
                for(k=0;k<=i-1;k++)
                    printf("%c",a[j+k]);
                printf("\n");
            }
        }




    return 0;
}
main()
{
    char s[102];
    int i,j,k;
    int n;
    scanf("%s",s);
    for(i=0;s[i]!='\0';i++)
    n=i;
    n=i;
    for(i=1;i<=n;i++)
    {
        for(j=0;s[j+i]!='\0';j++)
        {
            for(k=j;k<=j+i;k++)
            {
                if(s[k]!=s[2*j+i-k])
                {
                    break;
                }
            }
            if(k==j+i+1)
            {
                for(k=j;k<=j+i;k++)
                {
                    printf("%c",s[k]);
                }
                printf("\n");
            }
        }
    }
}
/*
  *@ title:?????
  *@ date:2010-11-28
  *@ author:1000012899 ???
  *@ description: ???????
 */
char c[501];
void huiwen(int, int);
int main()
{
    int l, i, j;
    cin.getline(c,501);
    l = strlen(c);
    for (i = 2; i <= l ; i++)
        for (j = 0; j <= l-i ; j ++)
            huiwen(j, i);
    return 0;
} 
void huiwen(int a, int b)
{
    int i, j, n;
    for (i = 1; i <= (b + 1) / 2; i ++)
        if (c[a-1+i] != c[a+b-i]) break;
    if (i == (b + 1) / 2 + 1)
    {
        for (i = 1 ; i <= b; i ++) cout << c[a-1+i];
        cout << endl;
    }
}
void main()
{
	int i=2,j,k,t,m,h,x,p;
	char s[1000],b[1000][1000];
	gets(s);
	m=strlen(s);
	for(i=2;i<=m;i=i+2)
	{
		for(k=0;k<=m-i;k++)
		{
			h=0;
			x=1;
			for(j=k;j<=k+i-1;j++)
			{
				b[k][j]=s[i+k-x];
				x++;
			}
			for(t=k;t<=k+i-1;t++)
			{
				if(b[k][t]!=s[t])
				{	h=1;
				break;
				}
			}
				if(h==0)
				{
					for(p=k;p<=k+i-1;p++)
						printf("%c",s[p]);
				printf("\n");
				}

		}
	}
}
/**
* @file homework.cpp
* @author ???
* @date 2012-11-12
* @description
* ??????: ????
*/
int main()
{
	char sen[500];
	int num[500], dis[500], maxdis = 0, k = 1;
	int i, j;
	cin >> sen;
	int n = 0;
	for (i = 0; i <= strlen(sen); i++)
	{
		if (sen[i] == sen[i+1]) // ????????????????????
		{
			n = n + 1;
			num[n] = i;
			for (j = 1; j <= i; j++)
			{
				if(sen[i - j] != sen[i + 1 + j])
					break;   // ?????????????
			}
			dis[n] = j; // ???????
			if (dis[n] > maxdis)
				maxdis = dis[n]; // ????????????
		}
		else
			continue;
	}
	do
	{
		// ????2????????????????????
		//??????????????????????????????????????????????????????????????dis????
		for (i = 1; i <= n; i++)
		{
			if (dis[i] >= k)
			{
				for (j = num[i] + 1 - k; j <= num[i] + k - 1; j++)
					cout << sen[j];
				cout << sen[j] << endl; // ???????????????
			} 
		}
		k = k + 1;
	} while (k <= maxdis);
	return 0;

}
int main()
{
	char s[501];
	gets(s);
	int i,p,q,l,n,j;
	n=strlen(s);
	for(l=1;l<n;l++)
		for(i=0;i<n-l;i++)
		{
			p=i;
			q=i+l;
			while(s[p]==s[q]&&p<q)
			{
				p++;
				q--;
			}
			if(q<=p)
			{
				for(j=i;j<=i+l;j++)
					printf("%c",s[j]);
				printf("\n");
			}
		}
		return 0;
}
int main()
{
	char str[505] = {0};
	cin >> str;
	int length = strlen(str);
	for (int l = 2 ; l <= length ; l++)
	{
		for (int i = 0; i <= length - l; i ++)
		{
			if (str[i] == str[i + l - 1])
			{
				int m = i + 1, n = i + l - 2;
				for (; m <= n ; m ++, n--)
				{
					if (str[m] != str[n])
						break;
				}
				if (m > n)
				{
					for (int m = i ; m <= i + l - 1; m++)
						cout << str[m];
					cout << endl;
				}
			}
		}
	}
	cin.get();
	cin.get();
	return 0;
}
//????
//2010?11?24?
//1000012753 ???
char str[1000];
int cycle(int a, int b)
{
	while (b >= 0)
	{
		if (str[a] == str[a + b - 1])
		{
			a++;
			b -= 2;
		}
		else
			return 1;
	}
	return 0;
}

int main()
{
	int i, j, k, l;
	cin >> str;
	l = strlen(str);
	for (i = 2; i <= l; i++)
		for (j = 0; j <= l - i; j++)
			if (cycle (j, i) == 0)
			{
				for (k = j; k < j + i; k++)
					cout << str[k];
				cout << endl;
			}
	return 0;
}
char a[100],sub[1000][100];
int l,sublen,cnt=0;
void jud(char t[100])
{
	int i,j,k;
	char s1[50],s2[50];
	memset(s1,'\0',sizeof(s1));
	memset(s2,'\0',sizeof(s2));
	if (strlen(t)%2==1)
	{
		for (i=strlen(t)/2-1;i>=0;i--)
		{
			s1[strlen(t)/2-1-i]=t[i];
		}
		for (i=strlen(t)/2+1;i<strlen(t);i++)
		{
			s2[i-strlen(t)/2-1]=t[i];
		}
	}
	else
	{
		for (i=strlen(t)/2-1;i>=0;i--)
		{
			s1[strlen(t)/2-1-i]=t[i];
		}
		for (i=strlen(t)/2;i<strlen(t);i++)
		{
			s2[i-strlen(t)/2]=t[i];
		}
	}
	for (i=1;i<=cnt;i++)
	{
		if (strcmp(sub[i],t)==0||strlen(t)==1)
			break;
		else
		{
			if (strcmp(s1,s2)==0)
				cout<<t<<endl;
			break;
		}
	}
}
void fen(int sl)
{
	int i,j;
	for (i=0;i<=l-sl;i++)
	{
		cnt++;
		for (j=0;j<sl;j++)
		{
			sub[cnt][j]=a[i+j];
		}
	}
}
void d()
{
	int i;
	l=strlen(a);
	memset(sub,'\0',sizeof(sub));
	for (sublen=2;sublen<=l;sublen++)
	{
		fen(sublen);
	}
	for (i=1;i<=cnt;i++)
	{
		jud(sub[i]);
	}
}
int main()
{
	cin>>a;
	d();
	return 0;
}
int main()
{
	int n;/*??????*/
	char c[501];
	gets(c);
	n=strlen(c);
	int i;
	int j;/*j???????????*/
	int k;
	int x;
	int m;/*????????????+1*/
	int t;/*?????*/
	int q;/*q???????????*/
	int p;/*p???????????*/
	int y;/*?????????*/
	for(i=2;i<=n;i++)/*?1??????n???*//*????? 1??????*/
	{
		m=n-i+1;
		for(j=0;j<m;j++)/*????????????????????*/
		{
			y=0;
			q=i/2+j;
			p=j+i-1;
			for(k=j;k<q;k++)
			{
				if(c[k]==c[p-k+j])
					y++;
			}
			if(y==i/2)
			{
				for(x=j;x<=p;x++)
					printf("%c",c[x]);
				printf("\n");
			}
		}
	}
	return 0;
}
int main()
{
    char s[502];
	int l = 0,k = 0,ii = 0,m = 0,step = 0,num = 0,flag = 0,i = 0,j = 0;
	cin >> s;
	l = strlen (s);
	for (j = 2;j <= l;j++)        //j?????
	{
		for (i = 0;i <= l-j;i++)    //i??????
		{
			flag = 1;
			for (ii = 1;ii <= j / 2;ii ++)
			{
				k = i + j - ii;
				if (s[i + ii - 1] != s[k])
				{
					flag = 0;
					break;
				}
			}
			if (flag == 1) 
			{
				for (ii = i;ii <= i + j - 1;ii++)
					cout << s[ii];
				cout << endl;
			}
		}
	}
	return 0;
}
int main()
{
	char c[505]={0};
	cin.getline(c,505,'\n');
	int num,i,j,k,standard,sum=0,q;
	for(num=0;;num++)
	{
		if(c[num]=='\0')
			break;
	}



	for(i=2;i<=num;i++)              //??????
	{ 
		for(k=0;k<=num-i;k++)       //?a[0]???a[num-i]
		{  
			sum=0;
			for(j=k;j<=k+i-1;j++)
			{ 

				if(c[j]==c[2*k+i-1-j])
					standard=1;
				else
					standard=0;
				sum=sum+standard;

			}

			if(sum==i)
			{
				for(q=k;q<k+i-1;q++)
					cout<<c[q];

				cout<<c[k+i-1]<<endl;
			}




		}









	}









	return 0;











}
void string1(char* a, int* x1, int* x2, int len);
void string2(char* a, int* x1, int* x2, int len);
void out(int q,int len, char* a);

int main()
{
	char a[501];
	int x1[501] = {0};
	int x2[501] = {0};
	cin >> a;
	int j = 0;
	for (int i = 1; a[i] != '\0'; i++)
	{
		if (a[i - 1] == a[i])
		{
			cout << a[i - 1] << a[i] << endl;
			x1[j] = i;
			j++;
		}
	}
	j = 0;
	for (int i = 1; a[i + 1] != '\0'; i++)
	{
		if (a[i - 1] == a[i + 1] && a[i] != a[i - 1])
		{
			cout << a[i - 1] << a[i] << a[i + 1] << endl;
			x2[j] = i;
			j++;
		}
	}
	//??????2?3???,??????
	string1(a, x1, x2, 3);//??????????
}

void string2(char* a, int* x1, int* x2, int len)//len(??)??????
{
	int temp1 = 0,temp2 = 0;
	for (int i = 0; x1[i] != 0; i++)
	{
		if(a[x1[i] + len / 2 - 1] == a[x1[i] - len / 2] &&  x1[i] + len / 2 - 1 != 0 &&  x1[i] + len / 2 - 1 < 501 && x1[i] - len / 2 >= 0)//?????
		{
			out(x1[i] - len / 2,len,a);
			x1[temp2] = x1[i];
			temp2++;
		}
	}
	x1[temp2] = 0;
	if(x1[0] == 0 && x2[0] == 0)
		exit(0);//?????????????????
	string1(a, x1, x2, ++len);
}

void string1(char* a, int* x1, int* x2, int len)//len(??)??????,?string1????
{
	int temp1 = 0,temp2 = 0;
	for (int i = 0; x2[i] != 0; i++)
	{
		if(a[x2[i] + len / 2] == a[x2[i] - len / 2] &&  x2[i] + len / 2 != 0 &&  x2[i] + len / 2 < 501 && x2[i] - len / 2 >= 0)//?????
		{
			out(x1[i] - len / 2,len,a);
			x2[temp2] = x2[i];//??x2???????
			temp2++;
		}
	}
	x2[temp2] = 0;
	if(x1[0] == 0 && x2[0] == 0)
		exit(0);//?????????????????
	string2(a, x1, x2, ++len);
}



void out(int q,int len, char* a)//???????
{
	for (int i = 0; i < len; i++)
		cout << a[q + i];
	cout << endl;
}
int main()
{
	char a[500] ,b[500]={'0'};
	int la,i,j,n=0,m;
	cin >> a;
	la = strlen(a);
	for(m=2;m<=la;m=m+2)
	{
		for(i=0;i<=la-m;i++)
		{
			for(j=i;j<=i+m/2-1;j++)
			{
				if(a[j]==a[m+2*i-1-j])
				{
					n++;
					b[j-i]=a[j];
					b[m+i-1-j]=a[m+2*i-1-j];
				}
			}
			if(n==m/2)
			{
					cout<<b<<endl;
				}
			n=0;
		}
	}
	return 0;
}
//***********************************************
//*   ????                                  *
//*   ??????                              *
//*   ?????2011?11?13?                  *
//***********************************************


void huiwen(char a[], int k, int n)//??????
{
	int i, j;
	for(i = 0; i <= n - k; i ++)//??????
	{
		for(j = i; j < k / 2 + i; j ++)//??????????
		{
			if(a[j] != a[k + i * 2 - 1 - j])//???????
				break;//?????
		}
		if(j == k / 2 + i)//??????????????
		{
			for(j = i; j <= k - 1 + i; j ++)
				cout << a[j];//????????
			cout << endl;
		}
	}
	return;
}

int main()
{
	char a[501];
	int k, n;
	cin.get(a, 500);//?????
	n = strlen(a);//??????
	for(k = 2; k <= n; k ++)
	{
		huiwen(a, k, n);//??????
	}
	return 0;
}
int main(){
	char a[500];
	int i,n,j,p;
	gets(a);
	for(n=2;n<=strlen(a);n++){
		for(i=0;i+n<=strlen(a);i++){
			p=1;
			for(j=i;j-i<=n-1;j++){
				if(a[j]==a[2*i+n-1-j]) p=p*1;
				else p=p*0;
			}
			if(p==1){
				for(j=i;j-i<=n-1;j++){
					printf("%c",a[j]);
				}	
				printf("\n");
			}
		}
	}
	return 0;
}
int main()
{
  char str[500];
  cin>>str;
  int i;
  int size=strlen(str); 
  for(i=1;i<size;i++)
  {
       int h,t;
       for(h=0;h<size-i;h++)
       {
         int h1=h; 
         t=h+i;
         int m;
         for(;h1<t;h1++,t--) 
         if(str[h1]!=str[t])
         break;
         if(h1>t)
         {
         for(m=h;m<=h+i;m++)
         cout<<str[m];
         cout<<endl; 
         }                 
       }              
  }
  cin.get();cin.get();cin.get();
  return 0;
}
int main ()
{
	char str[501];
	cin >> str;
	int len = strlen(str);
	int i=0, n=0, m=0, k=0, j=0,flag=0;
	for (i = 2; i <= len; i++)
	{
		for (j = 0; j <= len - i; j++)
		{
			for (n = j, m = i + j - 1; n < m; n++, m--)
			{
				flag = 1;
				if (str[n] != str[m])
				{
					flag = 0;
					break;
				}
			}
			if (flag)
			{
				for (k = j; k <= i + j - 1; k++)
					cout << str[k];
				cout << endl;
			}
		}
	}
	return 0;
}
int main()
{
    char a[100];
    int i=1,j,m,k,x = 0;
    while ((a[i] = cin.get() ) !=  '\n')
    {
        i++;
    }
    m = i - 1;
    for (j = 2; j <= m; j++)       //????????
    {
        for (i = 1; i <= m-j+1; i++)        //??????
        {
            for ( k = 0; k <= j/2-1; k++)      //??
            {
                x = 0;
                if ( a[i+k] != a[i+j-1-k] )
                {
                    x = 1;
                    break;
                }
            }
            if (x == 0)
            {
                for (k = 0; k <= j-1; k++)
                {
                    cout << a[i+k];
                }
                cout << endl;
            }
        }
    }
    return 0;
}
//****************************************************
//*  ? ? ?: homework.cpp                          *
//*  ?    ?: ???                                *
//*  ????: 2012?11?10?                        *
//*  ????: ????                              *
//****************************************************



int main()
{
	char st[502] = {0};  
	int len, longs, j, k, f; //len????  
	cin >> st;
	len = strlen (st);
	for (k = len + 1; k >= 0; k--) st[k + 1] = st[k]; //????? 
	st[0] = '\0';
	for (longs = 2; longs <= len; longs++) //????????? 
	{
		for (j = 1; j <= len - longs + 1; j++) // ?????? 
		{
			f = 1;
			for (k = j; k <= j + longs - 1; k++) //????????? 
			{
				if (st[k] != st[j + longs - 1 - k + j]) 
				{
					f = 0;
					break;
				}
			}
			if (f) //?????? 
			{
				for (k = j; k <= j + longs - 1; k++) cout << st[k];
				cout << endl;
			}
		}
	}
	
	return 0;
}
int main()
{
    char s[501];
    gets(s);
    int i,a,b,t,l,n,j;
    n=strlen(s);
    for(l=1;l<n;l++)
        for(i=0;i<n-l;i++)
        {
            a=i;b=i+l;t=0;
            while(s[a]==s[b]&&a<b) {a++;b--;};
            if(a>=b)
            {
                for(j=i;j<=i+l;j++) printf("%c",s[j]);
                printf("\n");
            }
        }
}
void find (char target[])//??
{
	int count = 0;
	int i,j,k;
	int flag;
	char change[500];
	for (i = 0;i <= 500;i++)//????????
	{
		if (target[i] != '\0')
			count++;
		else
			break;
	}
	for (i = 2;i <= count;i++)//??????
	{
		for (j = 0;j <= count - i;j++)//????????
		{
			flag = 1;
			for (k = j;k <= j + i - 1;k++)
				change[k] = target[k];
			for (k = 0;k <= i / 2 - 1;k++)//???????????
			{
				change[j + k] = target[j + i - 1 - k];
				change[j + i - 1 - k] = target[j + k];
			}
			for (k = 0;k < i - 1;k++)
			{
				if (change[j + k] != target[j + k])
					flag = 0;
			}
			if (flag == 1)//?????????????
			{
				for (k = j;k <= j + i - 1;k++)
					cout<<target[k];
				cout<<endl;
			}
		}
	}
}

int main()
{
	char target[500];
	cin.getline(target,500);
	find(target);
	return 0;
}
char f1(char ch[],int left,int right)
{
    if(left >= right)
	{
		return 1;
	} 
	else if(ch[left] != ch[right]) 
	{
		return 0;
	}
	else 
	{
		return f1(ch, left+1, right-1);
	}
}
char f2(char ch[],int start,int end)
{
    while(start<=end) 
	{
		putchar(ch[start++]);
	}
    putchar('\n');
	return '0';
}
main()
{
	char ch[500];
	int i,l,w;
	gets(ch);
	l=strlen(ch);
	for(w=1;w<=l;w++)
	{
		for(i=0;i<l-w;i++)
		{
			if(f1(ch,i,i+w))
				f2(ch,i,i+w);
		}
	}
	return 0;
}
int main()
{
char c[500];
int x,y,i,j,k,l,m,p=0;
gets(c);
char a[500];
strcpy(a,c);
for(i=0;;i++)
{
if(c[i]=='\0') break;
}

for(k=1;k<i;k++)
{
	for(j=0;c[k+j]!='\0';j++)
{
	p=0;
	strcpy(c,a);
x=c[j];y=c[k+j];
	if(x!=y) p=1;
	
    else for(l=1;x==y;l++)
   {
	   x=c[j+l];
   y=c[k+j-l];
   if(x!=y){p=1; break;}
   else if(j+l>=k+j-l) break;
   }
   if(p==0) 
   {
	   for(m=j;m<=k+j;m++)
	   {
	   printf("%c",c[m]);
	   
	   }
	   printf("\n");
   }
}
}
return 0;
}
/*
 * draft2.cpp
 *
 *  Created on: 2014-1-4
 *      Author: Mac
 */


char a[600], b[100], b1[100], *p;



int main()
{
	cin >> a;
	for(int len = 1; len < strlen(a); len++)
		for(int i = 0; i < strlen(a) - len; i++)
			{
			int j = 0;
			for(j = 0; j <= len/2; j++)
				{
				if(a[i+j] != a[i+len-j])
					break;
				}
			if (j == len/2 + 1)
				{
				for(int t = 0; t <= len; t++ )
					cout << a[i+t];
				cout << endl;
				}

			}
}
int main()
{
	int k,i,j,m;
	char a[550];
	gets(a);
	k=strlen(a);
	for(i=k;i>=1;i--)
	{a[i]=a[i-1];}
	i=2;
	while(i<k)
	{
		j=1;
		while(j<=k-i+1)
		{
			m=j;
			while(m<=j+i-1)
			{
				if(a[m]!=a[2*j+i-1-m]) break;
				m=m+1;
			}
			if(m==i+j)
			{
				for(m=j;m<=j+i-1;m++)
				{printf("%c",a[m]);}
				printf("\n");
			}
			j=j+1;
		}
		i=i+1;
	}
	return 0;
}