//(c)Terminator
#include <stdio.h>
#include <ctype.h>



const char* fpolyw(const char* s, const char** f, const char** l){
	const char* p, *t;

	while(*s) {
		while(*s && ! isalpha(*s))
			++s;

		for(p = s; isalpha(*p); ++p);

		t = p;
		if((p - s) > 2){
			*f = s;
			*l = p;
			for(--p; p > s; ++s, --p){
				if(*p != *s)
					break;
			}
			if(*p == *s)
				return t;
		}
		s = t;
	} 
	return NULL;
}



int main(void){
	const char* p, *f, *l;

	char s[] = "ABCEEExEEECBA???the, bla ADA, WOW, adida, spam,kook";

	p = &s[0];
	while((p = fpolyw(p, &f, &l)) != NULL){
//		fwrite(f, sizeof(char), (size_t)(l - f), stdout);
		while(f != l)
			putchar(*f++);
		putchar('\n');
	}
	return 0;
}