/*****************************************************************
** Palindrome - program to find palindromes in the input stream
**
** Words are read from the keyboard and inspected to see if they
** are palindromes.  (A palindrome is a word that is the
** same backwards as forwards, e.g., rotator .)
**
** Input is line-by-line.  Words are extracted from each line
** using the StringTokenizer class.
** Input ends when an end-of-file condition occurs, typically
** by entering Control-Z on the keyboard.
**
** (c) Scott MacKenzie, 2000                             
******************************************************************/
import java.io.*;
import java.util.*;

public class Palindrome
{
   public static void main(String[] args) throws IOException
   {
      // open keyboard for input (call it 'stdin')
      BufferedReader stdin =
         new BufferedReader(new InputStreamReader(System.in), 1);

      // prepare to extract words from lines
      String line;
      StringTokenizer words;
      String word;

      // main loop, repeat until no more input
      while ((line = stdin.readLine()) != null)
      {
         // tokenize the line
         words = new StringTokenizer(line);

         // process each word in the line
         while (words.hasMoreTokens())
         {
            word = words.nextToken();
            if (word.length() > 2) // must be at least 3 characters long
            {
               boolean isPalindrome = true;
               int i = 0;
               int j = word.length() - 1;
               while (i < j && isPalindrome)
               {
                  if ( !(word.charAt(i) == word.charAt(j)) )
                     isPalindrome = false;
                  i++;
                  j--;
               }
               if (isPalindrome)
                  System.out.println(word);
            }
         }       
      }
   }
}

