//最长回文字符串
//
//有a的时候报错,
int main()
{
char s[1000] = { 0 };
char m[1000] = { 0 };
scanf("%s", s);
int n = strlen(s);
int count = 0;
int max = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == s[i + 1])
{
int l = i;
int r = i + 1;
while (s[l--] == s[r++])
{
count = r - l;
}
l++;
r--;
if (count > max)
{
max = count;
int j = 0;
while (l <= r)
{
m[j++] = s[l++];
}
}
}
if (s[i] == s[i + 2])
{
int l = i;
int r = i + 2;
while (s[l--] == s[r++])
{
count = r - l;
}
l++;
r--;
if (count > max)
{
max = count;
int j = 0;
while (l <= r)
{
m[j++] = s[l++];
}
}
}
count = 0;
}
printf("%s", m);
return 0;
}