#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
string s;
while(cin>>s)
{
string x,y;
ll n=s.size();
ll j=n-1;
for(ll i=0;i<n;i++)
{
if(s[i]==s[j]){
j--;
x.pb(s[i]);
}
else
{
j=n-1;
y+=x;
y.pb(s[i]);
x.clear();
if(s[i]==s[j]){
y.erase(y.end()-1);
x.pb(s[i]);
j--;
}
}
}
reverse(y.begin(),y.end());
s+=y;
cout<<s<<endl;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgbGwgbG9uZyBsb25nIAojZGVmaW5lIHBiIHB1c2hfYmFjawppbnQgbWFpbigpCnsKCXN0cmluZyBzOwoJd2hpbGUoY2luPj5zKQoJewoJCXN0cmluZyB4LHk7CgkJbGwgbj1zLnNpemUoKTsKCQlsbCBqPW4tMTsKCQlmb3IobGwgaT0wO2k8bjtpKyspCgkJewoJCQlpZihzW2ldPT1zW2pdKXsKCQkJCWotLTsKCQkJCXgucGIoc1tpXSk7CgkJCX0KCQkJZWxzZQoJCQl7CgkJCQlqPW4tMTsKCQkJCXkrPXg7CgkJCQl5LnBiKHNbaV0pOwoJCQkJeC5jbGVhcigpOwoJCQkJaWYoc1tpXT09c1tqXSl7CgkJCQkJeS5lcmFzZSh5LmVuZCgpLTEpOwoJCQkJCXgucGIoc1tpXSk7CgkJCQkJai0tOwoJCQkJfQoKCQkJfQoJCX0KCQlyZXZlcnNlKHkuYmVnaW4oKSx5LmVuZCgpKTsKCQlzKz15OwoJCQoJCWNvdXQ8PHM8PGVuZGw7Cgl9Cgp9Cg==