// AOJ 1203: Napoleon's Grumble
// 2017.12.4 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define HASHSIZ 5003
typedef struct { char *s; int w; char odd; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash+HASHSIZ;			// Hash table

int lookup(char *s, int w, char odd)
{
	int i = (101 * *s + 103 * *(s+1)) % HASHSIZ;
	HASH *tp = hash + i;

	while (tp->s != NULL) {
		if (tp->odd == odd && tp->w >= w && !memcmp(tp->s, s, w)) return 0;
		if (++tp == hashend) tp = hash;
	}
	tp->s = s, tp->w = w, tp->odd = odd;
	return 1;
}

typedef struct { char *s; int w; char odd; } T;
T ans[2010]; int sz;

char s[1010], tmp[5010]; int len;
int first;

void print(char *s, int w)
{
	char c;

	c = s[w], s[w] = 0;
	if (first) first = 0;
	else putchar(' ');
	printf(s);
	s[w] = c;
}

void oddchk(int pos)
{
	int w;
	char *p, *q;

	p = s+pos-1, q = p+2, w = 1;
	while (p >= s) {
		if (*p != *q) break;
		p--, q++, w += 2;
	}
	if (w > 2) {
		ans[sz].s = p+1, ans[sz].w = w, ans[sz++].odd = 1;
	}
}

void evenchk(int pos)
{
	int w;
	char *p, *q;

	p = s+pos, q = p+1, w = 0;
	while (p >= s) {
		if (*p != *q) break;
		p--, q++, w += 2;
	}
	if (w > 2) {
		ans[sz].s = p+1, ans[sz].w = w, ans[sz++].odd = 0;
	}
}

int cmp(T *a, T *b) { if (b->w - a->w) return b->w - a->w; return memcmp(a->s, b->s, a->w); }

int main()
{
	int i, w, odd;
	char *p, *q;

	while (fgets(tmp, sizeof(tmp), stdin) != NULL) {
		memset(hash, 0, sizeof(hash));
		p = tmp, q = s; while (*p >= ' ') {
			if (isalpha(*p)) *q++ = toupper(*p);
			p++;
		}
		len = q - s, s[len] = 0;

		for (sz = 0, i = 1; i < len; i++) oddchk(i), evenchk(i);
		qsort(ans, sz, sizeof(T), cmp);

		for (first = 1, i = 0; i < sz; i++) {
			p = ans[i].s, w = ans[i].w, odd = ans[i].odd;
			if (lookup(p+w/2, (odd+w)/2, odd)) print(p, w);
		}
		putchar('\n');
	}
	return 0;
}