#include <stdio.h>
#include <stdlib.h>
// 10 meeellllliiooon btyes!
// yes, I know about C coders problems

#define BUFSIZE 10000000
#define TRUE 1
#define FALSE 0 

int main(int argc, char ** argv){
  int input, i, pal;
  char  *buf, *start, *end, *cache;
  
  // I know about this bug too
  buf = malloc(BUFSIZE*sizeof(char));
  //and this one
  input=fread(buf, sizeof(char),BUFSIZE,stdin);
  start=buf;
  end=buf+1;
  // if we have no input, then we get a return code of 0, not so nice
  cache=buf+input;
  while(end<cache){
    //split into lines
    if(*end=='\n'){
      i=0;
      pal=TRUE;
      // we pray that gcc caches these results
      while((start+i)<(end-i-1)){
	if(*(start+i)!=*(end-i-1)){
	  pal=FALSE;
	}
	i++;
      }
      if(pal){
        fwrite(start, sizeof(char), (end-start)+1, stdout);
      }
      start=end+1;
    }
    end++;
  }
  return 0;
}

