Woburn ECOO 1997 at Gramercy

Seeing Palindromes

INPUT FILE: pali.in
OUTPUT FILE: pali.out

For a given sentence (no more than 80 characters), find and print out all of the palindromes within it. A palindrome is a word which is the same when read either forwards or backwards, e.g. "rotator", "radar" or "ioi". The palindromes to be found will consist of only of letters and will be hidden in the sentence amongst other characters.
For example, consider the sentence "R2 2 123 o! TA to rot".
The word "rotator" is hidden in the sentence, as well as "otato", "tat", and "torot". Notice that "222" should NOT be considered since it is not made up of letters. To simplify your work consider only palindromes with at least two letters, i.e. do NOT consider "o" for output. Treat upper- and lower-case letters the same.
A final note: "rar" in the above example should NOT be considered a palindrome as there are letters "o" and "t" between "r" and "a". That is, the palindromes must NOT have other letters between them.

INPUT
You will be given several sentences, each sentence on a separate line, with the string "-1" indicating the end of input. For each sentence, guaranteed to be no more than 80 characters and on a single line, print out all possible palindromes. If there are none, then print out NONE.

OUTPUT
For each input sentence print out all possible palindromes, one per line. All palindromes should be printed out in lower case. Leave a blank line between palindromes of different sentences.

Sample Input File

123ioi321
WoburnECOOc1997
Was Ere Saw.
-1

Output for Sample Input (outputs can appear in any order)

ioi

cooc
oo

waseresaw
aseresa
seres
ere
Downloader failed! Response object 006~ASP 0159~Buffering Off~Buffering must be on.