#include <sys/time.h>

#define GRAD_TIME 739170133
/* more or less... assuming I graduate June 6, 1993 midnight. */

struct timeval tp;
struct timezone tzp;

int secs;
char numstr[10];

char *units[]={"zero","one","two","three","four","five",
		 "six","seven","eight","nine"};
char *teens[]={"ten","eleven","twelve","thirteen","fourteen",
		 "fifteen","sixteen","seventeen","eighteen","nineteen"};
char *tens[]={"zero","ten","twenty","thirty","fourty","fifty","sixty",
		"seventy","eighty","ninety"};

out (char *s)
{
  static int col = 0;
  char c;

  while (c = *s++) {
    if (c==' ' && col>60) c = '\n';
    if (c=='\n') 
      col = 0;
    else
      col++;
    putchar(c);
  }
}

triple(char *td, char *thing, int last)
{
  static int started;

  if (last == -1) started = 0;
  if ((last != -1) && (td[0] || td[1] || td[2]) && (started))
    out(", ");
  if (td[0]) {
    out(units[td[0]]);
    out(" hundred ");
    started = 1;
  }
  if ((td[1] || td[2]) && (td[0] || last==1) && started)
    out("and ");
  if (td[1]) {
    out((td[1] == 1) ? teens[td[2]] : tens[td[1]]);
    out((td[2] && td[1]!=1) ? "-" : " ");
  }
  if (td[2] && td[1]!=1) {
    out (units[td[2]]);
    out (" ");
  }
  if (td[0] || td[1] || td[2]) {
    started = 1;
    out(thing);
  } else if (last==1) out(" ");
}
      
main()
{  
  int i;

  gettimeofday(&tp, &tzp);
  secs = GRAD_TIME - tp.tv_sec;
  sprintf(numstr,"%09d",secs);
  for (i = 0; i < 9; i++)
    numstr[i] -= '0';
  out("There are ");
  triple(numstr,"million",-1);
  triple(numstr+3,"thousand",0);
  triple(numstr+6,"",1);
  out ("seconds left until kkkken ggggraduates.\n");
}
