#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
  FILE *fd;
  char buf[65536];
  char *ptr, *ptrp;
  int k=0, l=0, m=0, num=0;

  if (argv[1])
    fd = fopen(argv[1], "r");
  else
    exit(0);

  while(ptr=fgets(buf, 65000, fd)) {
    if (strstr(buf, "LOCAL TIME [local")) break;
    if (l==1) {
       if (m==1) {
          printf("English translation\n\n", buf);
       } else {
          printf("\n\n", ptr);
       }
       l = 0;
       ++m;
    }
    if (strstr(buf, "Make Love, not war!")) {
       ++k;
       continue;
    }
    if (k>=1) {
       if (strstr(buf, "_______TRANSLATION_____")) {
          printf("\n");
          printf("===============================================================================");
	  printf("\n\n");
          printf("English Translation\n\n", ptr);
	  continue;
       }
       ptr = buf;
       while(isspace(*ptr)) ++ptr;
       if (*ptr=='|') {
	 ++ptr;
         while(isspace(*ptr) || *ptr=='_') ++ptr;
       }
       ptrp = ptr+strlen(ptr)-1;
       while (isspace(*ptrp) && ptrp>ptr) { *ptrp = '\0'; --ptrp; }
       if (*ptrp=='|') {
	 *ptrp = ' ';
         while ((isspace(*ptrp) || *ptr=='_') && ptrp>ptr) { *ptrp = '\0'; --ptrp; }
       }
       ptrp = ptr;
       while (*ptrp) { if (*ptrp=='_') *ptrp = ' '; ++ptrp; }
       ptrp = ptr+strlen(ptr)-1;
       while (ptrp>=ptr && isspace(*ptrp)) { *ptrp = '\0'; --ptrp; }
       if (num==0 && *ptr=='\0') continue;
       printf("%s\n", ptr);
       ++num;
       if (num==1) printf("\n");
    }
  }
  fclose(fd);
}
