/*
?? 
????????????????? 
??????????????????????????? 
??? abba   cccdeedccc??????? 

????????????????2
 
???? 
????????????????500?? 
??? 
abcddcbaab
 
???? 
?????????????????????? 
????????????????????????????? 
????abcddcbaab 
??? 
dd 
aa 
cddc 
baab 
bcddcb 
abcddcba
 
???? 
123321125775165561
 
???? 
33
11
77
55
2332
2112
5775
6556
123321
165561
*/


int main()
{
	char str[501]; //?????????
	int checklen,strlen,i,j,temp;  //checklen??????????
	cin>>str;

	for (i=0;str[i]!='\0';i++)
	{
		strlen=i;
	}  //strlen?????????1

	for (checklen=2;checklen<=strlen+1;checklen++)   //??????????2????
	{
        for (i=0;i<=strlen-checklen+1;i++)  //?????????????
		{
			for (j=0;;j++)   
			{
                if ((str[i+j]==str[i+checklen-1-j])&&((i+j)<(i+checklen-1-j)))     continue;
				else if (str[i+j]!=str[i+checklen-1-j])     break;
				else if ((str[i+j]==str[i+checklen-1-j])&&((i+j)>=(i+checklen-1-j)))
				{
			        temp=checklen;
			        for (temp=0;temp<=checklen-1;temp++)
			        {
				        cout<<str[i+temp];
			        }
			        cout<<endl;
					break;
				}    //????????????????????
			}
		}
	}
	return 0;
}