#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    char text[256],cuv[25],inv[25],*p,*q;
    cout<<"Introduceti textul: ";
    cin.get(text,256);
    cin.get();
    q=strchr(text,' ');
    p=text;
    while(q){
        *cuv=NULL;
        strncat(cuv,p,q-p);
        strcpy(inv,cuv);
        strrev(inv);
            if(!stricmp(cuv,inv)) cout<<cuv<<" ";
        p=q+1;
        q=strchr(p,' ');
    }
    *cuv=NULL;
    strncat(cuv,p,q-p);
    strcpy(inv,cuv);
    strrev(inv);
    if(!stricmp(cuv,inv)) cout<<cuv;
    return 0;
}
